Skip to content

Develop - #2107

Open
LiliiaVol wants to merge 6 commits into
mate-academy:masterfrom
LiliiaVol:develop
Open

Develop#2107
LiliiaVol wants to merge 6 commits into
mate-academy:masterfrom
LiliiaVol:develop

Conversation

@LiliiaVol

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

Your solution requires changes to meet the task requirements. The sortList function has two critical issues:

  1. Ignores its parameter: The function receives a list parameter but uses the global li variable instead. The function should sort the parameter it receives, not a global variable.

  2. Doesn't append to the list: According to the requirements, sortList should "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

  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 +10 to +14
const sortList = (list) => {
return list.sort(
(el1, el2) =>
changeToNum(el2.dataset.salary) - changeToNum(el1.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 list parameter is received but never used - the function sorts the global li variable instead. The function should sort the parameter it receives.

Comment thread src/scripts/main.js Outdated
Comment on lines +10 to +14
const sortList = (list) => {
return list.sort(
(el1, el2) =>
changeToNum(el2.dataset.salary) - changeToNum(el1.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.

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 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 requires changes to meet the task requirements. There are two critical blockers:

  1. Missing getEmployees function: 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.

  2. sortList ignores its parameter: The function receives a list parameter but uses the global ul variable for appending (lines 11-16). This makes the function non-reusable and violates the requirement to use the parameter it receives - checklist item 8.

  3. Both functions must be called: Per checklist item 5, both getEmployees and sortList need to be invoked, but currently only sortList is 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

  1. Rate AI review example ↩

  2. Re-request AI review example ↩

  3. Add AI review comments example ↩

@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. 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! ✨

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