Skip to content

task solution#2209

Open
fedechkova wants to merge 2 commits intomate-academy:masterfrom
fedechkova:develop
Open

task solution#2209
fedechkova wants to merge 2 commits intomate-academy:masterfrom
fedechkova:develop

Conversation

@fedechkova
Copy link

No description provided.

Copy link

@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 the core logic for calculating the population data! However, I am requesting changes because two key requirements from the task description have not been met. First, the instructions state that only the src/scripts/main.js file should be modified, so please revert the changes made to the .scss files. Second, your code must validate that the population text can be converted to a number before performing calculations. Currently, a non-numeric value would result in NaN for the total and average. Please add a check to handle these cases, for example by filtering out invalid numbers.


✨ 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 on lines +5 to +9
const populations = Array.from(populationElement).map((element) => {
const text = element.textContent.replace(/,/g, '').trim();

return Number(text);
});

Choose a reason for hiding this comment

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

The task requires you to 'Make sure that the given string can be converted to a number'. Your current implementation doesn't account for cases where element.textContent might not be a valid number. If that happens, Number(text) will produce NaN, which will cause both the total and average to become NaN. Consider adding a check to ensure you are only working with valid numbers, for example by filtering out any NaN values from the populations array.

Copy link

@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! The validation to handle non-numeric data is implemented correctly, and the calculations are spot on.

However, I am requesting changes because the task has a strict requirement that only the src/scripts/main.js file should be modified. Your submission includes changes to files within the src/styles/ directory.

Please revert all modifications in the style files. 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


body {
background: #eee;
counter-reset: section;

Choose a reason for hiding this comment

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

According to the task instructions, you should not make any changes to style files. Please revert all modifications in the src/styles/ directory.

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