Skip to content

add task solution#2146

Open
olieniev wants to merge 3 commits intomate-academy:masterfrom
olieniev:develop
Open

add task solution#2146
olieniev wants to merge 3 commits intomate-academy:masterfrom
olieniev:develop

Conversation

@olieniev
Copy link
Copy Markdown

@olieniev olieniev commented Jan 7, 2026

No description provided.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

Great job implementing the core logic in main.js to calculate and display the population data! The use of toLocaleString() for formatting is a nice touch.

However, a couple of changes are needed before this can be approved:

  1. The task instructions explicitly state that only the src/scripts/main.js file should be changed. Your submission includes modifications to style files (src/styles/_fonts.scss and src/styles/main.scss). Please revert the changes in all other files.
  2. In src/scripts/main.js, the calculation works for the current data, but it doesn't validate the input. If a <span> contained non-numeric text, the calculation would result in NaN. To fully meet the requirement to 'Make sure that the given string can be converted to a number', please add a check, for instance with isNaN(), to handle such cases and make your code more robust.

Once you've addressed these points, your solution will be ready!


✨ 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
let total = 0;

populations.forEach(
(population) => (total += Number(population.textContent.split(',').join(''))),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This calculation works for the current data. However, requirement #2 asks you to 'Make sure that the given string can be converted to a number'. Your current code doesn't explicitly check if the conversion is successful. Consider what might happen if a <span> contained non-numeric text. Adding a check, for instance with isNaN(), would make your code more robust and fully meet the requirement.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

Great work on updating the JavaScript logic! The addition of the isNaN check is an excellent improvement and makes the calculation much more robust. However, this submission requires a change because it modifies files other than the allowed src/scripts/main.js. A critical requirement for this task is that only the main.js file should be changed. Your submission includes modifications to src/styles/main.scss. Please revert the changes in that file to proceed. Once you've done that, your solution will be ready for approval!


✨ 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/styles/main.scss Outdated
margin: 32px 0;
list-style: none;
padding: 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This file should not be modified. According to the task instructions and the previous review feedback, all changes must be made only in the src/scripts/main.js file. Please revert the changes made here.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Review Summary

Excellent work on the JavaScript logic in src/scripts/main.js! You've perfectly implemented the calculations for the total and average populations, and the number formatting is spot on.

I am approving this submission as an educational override, but please note that the task required that only the main.js file be changed. Your submission included modifications to src/styles/main.scss, which should have been reverted. In future projects, be sure to adhere strictly to the file modification constraints.

Overall, your JavaScript skills are looking great. Keep up the fantastic work!


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

Footnotes

  1. Rate AI review example

Comment thread src/styles/main.scss
.total,
.average {
font-size: 20px;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Per the task instructions and the previous review feedback, this file should not be changed. Please revert any modifications made to src/styles/main.scss.

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