Repository navigation
Solution - #2104
Solution#2104Patryk91sz wants to merge 2 commits into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
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
| return ( | ||
| Number(b.dataset.salary.replaceAll('$', '').replaceAll(',', '')) - | ||
| Number(a.dataset.salary.replaceAll('$', '').replaceAll(',', '')) |
There was a problem hiding this comment.
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.
| position: employee.dataset.position, | ||
| salary: employee.dataset.salary, |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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! ✨
No description provided.