Repository navigation
Conversation
This reverts commit 44a5f56.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution requires changes to meet the task requirements. The sortList function has two critical issues:
-
Ignores its parameter: The function receives a
listparameter but uses the globallivariable instead. The function should sort the parameter it receives, not a global variable. -
Doesn't append to the list: According to the requirements,
sortListshould "append sorted items to list". Currently, appending happens outside the function on line 31 (ul.append(...sortList(li))), but the function should handle this internally.
Please refactor sortList to use its list parameter and handle the appending internally, making it a reusable function as required.
✨ 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
| const sortList = (list) => { | ||
| return list.sort( | ||
| (el1, el2) => | ||
| changeToNum(el2.dataset.salary) - changeToNum(el1.dataset.salary), | ||
| ); |
There was a problem hiding this comment.
The list parameter is received but never used - the function sorts the global li variable instead. The function should sort the parameter it receives.
| const sortList = (list) => { | ||
| return list.sort( | ||
| (el1, el2) => | ||
| changeToNum(el2.dataset.salary) - changeToNum(el1.dataset.salary), | ||
| ); |
There was a problem hiding this comment.
According to the requirements, sortList should append sorted items to the list. Currently, appending happens outside the function on line 31. The function should handle both sorting AND appending internally.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution requires changes to meet the task requirements. There are two critical blockers:
-
Missing
getEmployeesfunction: The task explicitly requires a function that returns an array of employee objects with{name, position, salary, age}schema. This function is completely absent from your code. -
sortListignores its parameter: The function receives alistparameter but uses the globalulvariable for appending (lines 11-16). This makes the function non-reusable and violates the requirement to use the parameter it receives - checklist item 8. -
Both functions must be called: Per checklist item 5, both
getEmployeesandsortListneed to be invoked, but currently onlysortListis called.
Please add the getEmployees function that returns employee data and update sortList to use its list parameter instead of the global ul variable.
✨ 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved. All task requirements have been successfully implemented - the getEmployees function now returns employee objects with the correct {name, position, salary, age} schema, and the sortList function properly uses its ulList parameter to sort employees by salary in descending order. The changeToNum helper function correctly converts salary strings to numbers for comparison. Both functions are called as required, and the implementation uses data attributes effectively. Great work on addressing all the previous feedback and completing this task!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.