Skip to content

add task solution#2172

Open
NiaAnastasia wants to merge 4 commits intomate-academy:masterfrom
NiaAnastasia:develop
Open

add task solution#2172
NiaAnastasia wants to merge 4 commits intomate-academy:masterfrom
NiaAnastasia:develop

Conversation

@NiaAnastasia
Copy link

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 JavaScript logic! The code to calculate and display the population data is clean and functions perfectly. However, changes are needed because the task had a strict requirement to only modify the src/scripts/main.js file. Your submission also included changes to style files (src/styles/main.scss and src/styles/_fonts.scss), which violates this constraint. Please revert the changes in all other files and resubmit. I'm ready to approve it once that single correction is made.


✨ 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

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 addressing the previous feedback! The core logic for calculating the total and average is implemented correctly. I am requesting one final change to address a missed requirement before approving.

The task requires you to 'Make sure that the given string can be converted to a number' before performing calculations. Your current code converts the string directly, but it doesn't validate it first. If any of the span elements contained non-numeric text (e.g., 'N/A'), your calculations would result in NaN.

To make your solution more robust, please add a step to filter out any non-numeric values before you sum them. A check using !isNaN() would be a great way to handle this. Keep up the great work!


✨ 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 7
const populationNumbers = populationSpans.map((el) => {
return Number(el.textContent.replaceAll(',', ''));
});

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 code converts the string but doesn't validate it first. If any of the span elements contained text that couldn't be converted to a number (e.g., 'N/A'), Number() would produce NaN, and your final total and average would also be NaN. It would be more robust to filter out any non-numeric values before calculating the sum.

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! I am approving your solution. You've successfully addressed the feedback from the previous review by adding the filter step to ensure only valid numbers are used in the calculation. Your code is now more robust and meets all the task requirements perfectly. This is a fantastic implementation, great job!


✨ 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