Skip to content

Solution - #2104

Open
Patryk91sz wants to merge 2 commits into
mate-academy:masterfrom
Patryk91sz:develop
Open

Patryk91sz wants to merge 2 commits into
mate-academy:masterfrom
Patryk91sz:develop

Conversation

@Patryk91sz

Copy link
Copy Markdown

No description provided.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

I am requesting changes because the implementation has two critical issues that violate explicit task requirements. First, the task explicitly requires a helper function to convert salary strings to numbers, but the conversion logic is only done inline within the sort function. You need to create a separate helper function (e.g., parseSalary) and use it in both sortList and getEmployees. Second, the getEmployees function returns the raw salary string (e.g., '$100,000') instead of converting it to a number as required by the employee schema. Use your helper function here to return salary as a number. These are core requirements that must be met for the task to be complete.


✨ 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 +9 to +11
return (
Number(b.dataset.salary.replaceAll('$', '').replaceAll(',', '')) -
Number(a.dataset.salary.replaceAll('$', '').replaceAll(',', ''))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The task requires a helper function to convert salary string to number, but the conversion is done inline within the sort function. Consider extracting this into a separate helper function as specified in the requirements.

Comment thread src/scripts/main.js Outdated
Comment on lines +26 to +27
position: employee.dataset.position,
salary: employee.dataset.salary,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The salary field in the employee object should be a number (as per the schema), but this returns the raw string (e.g., '$100,000'). Convert it to a number using the helper function.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

Your solution is approved. The implementation correctly addresses all requirements: you created a separate helper function that converts salary strings to numbers using Number(salary.replaceAll('$', '').replaceAll(',', '')), and this helper is properly used in both sortList (for descending salary comparison) and getEmployees (to return salary as a number in the employee objects). Both functions are called at the end of the file. All core functional requirements are met, and the code correctly returns salary as a number in the employee object schema {name, position, salary, age}.


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

Footnotes

  1. Rate AI review example ↩

This branch has not been deployed

No deployments
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