Skip to content

Develop#2004

Open
interpunktus wants to merge 3 commits into
mate-academy:masterfrom
interpunktus:develop
Open

Develop#2004
interpunktus wants to merge 3 commits into
mate-academy:masterfrom
interpunktus:develop

Conversation

@interpunktus

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 code has a critical bug that's causing all tests to fail. On line where you have const listOfEmployees = [...document.querySelector('ul')], the spread operator is incorrectly wrapping the <ul> element. This creates an array of the ul's child nodes instead of passing the actual DOM element to your functions. Since arrays don't have a querySelectorAll method, both sortList and getEmployees fail when they try to call list.querySelectorAll('li'). The fix is straightforward: remove the spread operator and pass the element directly: javascript const listOfEmployees = document.querySelector('ul'); Once you make this change, your sortList and getEmployees functions will receive the actual <ul> element and work correctly. Your sorting logic and employee extraction are sound—the spread operator is the only thing preventing everything from functioning.


✨ 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

// write code here

const listOfEmployees = [...document.querySelector('ul')];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CRITICAL BUG: Wrapping document.querySelector('ul') in [...spread] creates an array containing the <ul> element. Both sortList and getEmployees call list.querySelectorAll('li'), but arrays don't have this method. Pass the <ul> element directly without spreading.

@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

All requirements have been successfully implemented: the sortList function correctly sorts employees by salary in descending order using b.dataset.salary - a.dataset.salary, the getEmployees function returns an array of employee objects with the correct schema, and the parseSalary helper properly converts string values to numbers by stripping currency symbols and commas. Both functions are invoked at the end of the file with the DOM element properly passed as an argument. The critical spread operator issue from the previous review has been resolved, and all checklist items pass. Great work on fixing the bug and completing the task!


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

Footnotes

  1. Rate AI review example

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