Skip to content

task solution#1988

Open
damian-k-dev wants to merge 2 commits into
mate-academy:masterfrom
damian-k-dev:develop
Open

task solution#1988
damian-k-dev wants to merge 2 commits into
mate-academy:masterfrom
damian-k-dev:develop

Conversation

@damian-k-dev
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Review Summary

Your solution has a critical issue that must be fixed. The sortList function accepts a list parameter but completely ignores it, instead using the global listOfEmployees variable. This breaks the function's reusability and violates the requirement that the function should take and use a list parameter. You need to replace all references to listOfEmployees inside the function with the list parameter — for example, change listOfEmployees.querySelectorAll('li') to list.querySelectorAll('li'), and listOfEmployees.append to list.append. Additionally, the getEmployees function returns salary as a string, but the expected schema likely requires a numeric value — consider using parseFloat() or your convertToNumber helper for the salary property. The core sorting logic and overall structure look solid, so these fixes should get you to a passing implementation.


✨ 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
}

function sortList(list) {
const sorted = [...listOfEmployees.querySelectorAll('li')].sort((a, b) => {
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 ignored - the function uses the global listOfEmployees variable instead. Use list parameter to query the list items for proper function behavior.

Comment thread src/scripts/main.js Outdated
);
});

sorted.forEach((employee) => listOfEmployees.append(employee));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue as line 14 - this should be list.append(employee) to use the passed parameter, not the global variable.

Comment thread src/scripts/main.js
Comment on lines +23 to +24
function getEmployees(list) {
const employees = [...list.querySelectorAll('li')].map((employee) => {
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 function takes list as a parameter but uses listOfEmployees directly instead. This defeats the purpose of the parameter. Change listOfEmployees.querySelectorAll('li') to list.querySelectorAll('li').

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

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 and meets all requirements. Both critical issues from the previous review have been successfully resolved: sortList now correctly uses its list parameter throughout, and getEmployees properly converts salary values to numbers using the convertToNumber helper function. The implementation follows the correct employee object schema with all required properties extracted properly. Great work on fixing the parameter usage and data type conversion - these were exactly the right changes to make. Your code is ready for use!


✨ 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