Skip to content

Solution#1973

Open
Br0No wants to merge 1 commit into
mate-academy:masterfrom
Br0No:develop
Open

Solution#1973
Br0No wants to merge 1 commit into
mate-academy:masterfrom
Br0No:develop

Conversation

@Br0No
Copy link
Copy Markdown

@Br0No Br0No commented Apr 15, 2026

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

I am requesting changes because there are a few contract-breaking issues in src/scripts/main.js and the PR also touches files that were supposed to remain unchanged.

The critical functional issue is in sortList(listData) in src/scripts/main.js: inside the function you append the sorted <li> elements to the outer list variable instead of the listData parameter, which means the function relies on a specific global and does not behave correctly if called with any other list; update the forEach so it appends to listData (e.g. items.forEach(item => listData.appendChild(item))). Another core issue is in getEmployees(listData), where you build the name field using li.innerText; depending on the markup, this can include position, age, and salary text, so you should instead select the specific child that contains the name, for example li.querySelector('.name').textContent.trim() or whatever selector matches your HTML. There is also a checklist violation: the task required changing only main.js, but this PR includes additional changes (e.g. README.md, package.json, and workflow files), so those extra modifications need to be reverted or moved to a separate branch/PR. If tests expect numeric ages, you should also ensure age is converted with Number(li.dataset.age) instead of leaving it as a string.

Overall, your salary parsing, sorting logic, and the general structure of sortList and getEmployees look solid, so once you wire the functions to their parameters correctly, narrow the name selector, and limit changes to main.js, the solution will align well with 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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/scripts/main.js
const items = Array.from(listData.children);

items.sort((a, b) => getSalary(b) - getSalary(a));
items.forEach((item) => list.appendChild(item));
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 code appends sorted items to the outer list variable instead of the function parameter listData. To respect the function contract and avoid relying on the global variable, append items to listData (for example: items.forEach(item => listData.appendChild(item))).

Comment thread src/scripts/main.js
function getEmployees(listData) {
return Array.from(listData.children).map((li) => {
return {
name: li.innerText,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using li.innerText for the name field may capture other text from the whole list item (position, age, salary) depending on the markup. Select the specific child element that contains the name (for example li.querySelector('.name').innerText or the appropriate selector in your HTML) to ensure name contains only the person's name.

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.

3 participants