Skip to content

Completed - #2355

Open
skuzmenk wants to merge 2 commits into
mate-academy:masterfrom
skuzmenk:develop
Open

skuzmenk wants to merge 2 commits into
mate-academy:masterfrom
skuzmenk:develop

Conversation

@skuzmenk

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I am requesting changes because a core requirement is not met: the displayed total and average must include thousands separators. This is a functional requirement for output formatting and directly affects correctness of the result shown to users.

Critical issues to fix:

  • In src/scripts/main.js, the values assigned to span.total-population and span.average-population are not formatted with thousands separators. The task requires using a thousands separator (e.g., toLocaleString() or Intl.NumberFormat). Update the assignments so that total.toLocaleString() and average.toLocaleString() (or equivalent) are used when setting textContent.

Why this matters: without proper formatting, the UI does not match the specified display style for populations, failing the requirement.

Minor suggestion:

  • Consider handling the case of zero items to avoid NaN in the average, and decide on rounding for the average if many decimals appear (e.g., Math.round or fixed decimals) before formatting.

You did a solid job parsing and computing values; add the formatting and this will meet the requirements. Keep it up!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js Outdated
const total = populations.reduce((sum, population) => sum + population, 0);
const average = total / populations.length;

document.querySelector('.total-population').textContent = total;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The total value needs to be formatted with thousands separators (e.g., using toLocaleString()) to match the display style of source populations as required by the task.

Comment thread src/scripts/main.js Outdated
const average = total / populations.length;

document.querySelector('.total-population').textContent = total;
document.querySelector('.average-population').textContent = average;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The average value needs to be formatted with thousands separators (e.g., using toLocaleString()) to match the display style of source populations as required by the task.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Here is my approval: your implementation correctly collects all .population spans, strips formatting, converts to numbers, filters out non-numerics, and computes both total and average safely (guarding against empty inputs). The results are displayed in .average-population and .total-population with thousands separators via toLocaleString(), and the average is rounded, which satisfies the requirement to present a clean number. There are no critical blockers; functionality aligns with the task and handles edge cases gracefully.

Minor suggestions (non-blocking): consider specifying a locale in toLocaleString('en-US') for consistent separators across environments, and verify linting locally to match project style rules. Great job addressing the earlier formatting details and delivering a clear, robust solution.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants