Skip to content

add task solution#1789

Open
Alternate001 wants to merge 6 commits intomate-academy:masterfrom
Alternate001:master
Open

add task solution#1789
Alternate001 wants to merge 6 commits intomate-academy:masterfrom
Alternate001:master

Conversation

@Alternate001
Copy link
Copy Markdown

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.

Sorry, the pull request review was unsuccessful for the following reasons:

Warning

Something went wrong while processing the review.
[CODE: UNK]

If the issue is within your control, please address it.
The next review attempt will automatically launch in about 1 hour.
If you believe this is an error or need assistance, please contact the support team.

@Alternate001
Copy link
Copy Markdown
Author

give me feedback

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 this task! Your solution is approved as you've correctly implemented all the functional requirements. The table is generated dynamically, and the calculations for age and century are spot on.

As a suggestion for future improvement, it's a good practice to avoid modifying original data structures. Instead of adding age and century properties to each person object, you could calculate these values just-in-time when creating the table cells. This prevents unintended side effects, which is a key principle in writing robust code.

Don't worry about the failing check; it's due to an environment issue and not your code. Keep up the great effort!


✨ 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
Comment on lines +368 to +375
person.age = age;
person.century = century;

if (person.sex === 'm') {
person.sex = 'Male';
} else {
person.sex = 'Female';
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

While this approach works for this task, you're modifying the original person object here by adding new properties (age, century) and changing an existing one (sex). This is known as a side effect, and it's generally best to avoid modifying input data directly.

A safer approach would be to perform calculations and transformations when you need the values, without altering the source object. For example, you could determine the gender string inside the loop when creating the gender cell, rather than changing person.sex.

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 this task! Your code meets all the functional requirements, and the table is generated correctly with the calculated age and century for each person. I am approving your solution.

You may notice a failed check in the logs, but this is due to an environment issue with our test runner and is not a problem with your code.

As a suggestion for future improvement, it's a good practice to avoid modifying input data. In your loop, the lines person.age = age; and person.century = century; alter the original person object. While it works here, avoiding these kinds of "side effects" makes code more predictable. Since you already use the local variables to populate the table, these lines aren't necessary for the code to function. This is just a best-practice tip and not a required change.

Excellent job!


✨ 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
Comment on lines +365 to +366
person.age = age;
person.century = century;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These two lines modify the original person object. This is a side effect that should generally be avoided, as it can make code harder to debug.

Since your if conditions later in the loop already use the local age and century variables to populate the table cells, these lines are also not needed for the code to work. Please remove them.

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! You've done a fantastic job addressing the feedback from the previous review by no longer modifying the input data directly. This is a great best practice that makes your code cleaner and more predictable. Your solution now perfectly meets all the requirements, and the table is generated correctly. I am happy to approve your submission. Keep up the great work!


✨ 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