Skip to content

solution - #2098

Open
smialeknicole wants to merge 2 commits into
mate-academy:masterfrom
smialeknicole:develop
Open

smialeknicole wants to merge 2 commits into
mate-academy:masterfrom
smialeknicole:develop

Conversation

@smialeknicole

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 implementation is missing the required getEmployees function, which is a critical blocker. The task explicitly requires two functions: sortList and getEmployees. You need to implement getEmployees that takes a list parameter and returns an array of employee objects with the schema { name, position, salary, age }. Additionally, both functions need to be called in the code - currently only sortList is invoked at line 21. Please add the missing getEmployees function and ensure it's called to retrieve the employee data.


✨ 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 +1 to +21
'use strict';

// write code here
function sortList (list){
const employees = Array.from(document.querySelectorAll('li'));

function formatNumber (salary) {
const formated = salary.slice(1).replace(",", "");
return Number(formated);
}

employees.sort((a, b) => {
return (formatNumber(b.dataset.salary) - formatNumber(a.dataset.salary));
});

employees.forEach((item) => {
list.append(item);
});
}

const list = document.querySelector('ul');
sortList(list);

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 getEmployees function is completely missing. The task requires two functions: sortList and getEmployees. This function should take a list parameter and return an array of objects with the schema: { name, position, salary, age }.

Comment thread src/scripts/main.js Outdated
}

const list = document.querySelector('ul');
sortList(list);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Both functions need to be called in the code. Currently only sortList is called at line 21, but getEmployees should also be called to get the array of employees.

@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 implementation fully addresses all the requirements from the task. The sortList function correctly sorts employees by salary in descending order using the formatNumber helper to convert salary strings to numbers, and the getEmployees function properly returns an array of employee objects with the required schema { name, position, salary, age }. Both functions are implemented with the correct parameters and are called in the code as expected. All checklist items pass, and there are no critical blockers preventing task completion.


✨ 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