PR#1999
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation has critical issues that violate the task requirements. The main problems are: (1) sortList should accept a DOM list element (<ul>) as the list parameter, sort the actual <li> items in-place, and append them back to the DOM — but you're currently passing an already-converted employee array. (2) getEmployees parameter should be named list not pagesTag. (3) parseSalary helper function must be a standalone module-level function, not defined inside sortList. (4) In the execution block at line 26, sortList() is called without arguments when it should receive the DOM list element. The core architecture needs to change so that sortList receives a DOM reference, manipulates <li> elements directly, and the helper functions work with the correct signatures as specified in the 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
| }); | ||
| } | ||
|
|
||
| function sortList(employees) { |
There was a problem hiding this comment.
The function signature doesn't match requirements. The task specifies sortList should take a list property (the DOM list element), not an array of employees. Currently, employee objects are passed instead of the DOM list.
| 'use strict'; | ||
|
|
||
| // write code here | ||
| function getEmployees(pagesTag) { |
There was a problem hiding this comment.
The function signature doesn't match requirements. The task specifies getEmployees should take a list property (the DOM list element). Currently the parameter is named pagesTag instead of list.
| } | ||
|
|
||
| const listQuerry = document.querySelectorAll('li'); | ||
| const list = getEmployees(listQuerry); |
There was a problem hiding this comment.
According to requirements, sortList should sort and append DOM list items directly, not work with an already-converted employee array. The current flow (getEmployees → sortList → rebuild DOM) doesn't match the specified behavior where sortList should manipulate the DOM list directly.
|
|
||
| function sortList(employees) { | ||
| return employees.sort((a, b) => { | ||
| const parseSalary = (salary) => { |
There was a problem hiding this comment.
The helper function for salary conversion should be a separate standalone function (as mentioned in requirements), not defined inside sortList. Consider moving parseSalary outside the sorting function.
|
|
||
| const listQuerry = document.querySelectorAll('li'); | ||
| const list = getEmployees(listQuerry); | ||
| const sortedEmployees = sortList(list); |
There was a problem hiding this comment.
The sortList function is called without any arguments here (line 26), but according to requirements, it should be called with the DOM list element as parameter. Similarly, getEmployees on line 25 is called with listQuerry but should be called appropriately per the requirements.
No description provided.