Skip to content

sol#2234

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

sol#2234
leemonch1k-space wants to merge 3 commits intomate-academy:masterfrom
leemonch1k-space:develop

Conversation

@leemonch1k-space
Copy link
Copy Markdown

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 on implementing the calculation and formatting for the total and average population! Your code works correctly with the current data.

However, I'm requesting a change because a key requirement from the task description is missing. You need to add a check to ensure that the population string can be converted to a number before you use it in your calculations. Without this validation, if one of the <span> elements contained text that wasn't a number, the entire calculation would result in NaN.

Please add a check, for example using !isNaN(), to guard against this possibility. This will make your code more robust and fully meet the task requirements.


✨ 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
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 adding the !isNaN check to make your total calculation more robust! That was the main point of the last review, and you've handled it well.

However, this has introduced a subtle issue in how the average is calculated, which requires a change. While your total correctly ignores non-numeric values, the average is still being calculated by dividing by the total number of elements, including the invalid ones.

To fix this, the divisor for the average should be the count of only the valid numbers that were included in the total sum. You'll need to track this count separately.


✨ 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
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! I am approving your solution. You've successfully addressed the feedback from the previous review, and the logic for calculating the average is now correct. The code is well-structured, robust, and meets all the task requirements. Great job on this iteration!


✨ 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