Skip to content

add task solution#1911

Open
nkoropka wants to merge 3 commits intomate-academy:masterfrom
nkoropka:develop
Open

add task solution#1911
nkoropka wants to merge 3 commits intomate-academy:masterfrom
nkoropka:develop

Conversation

@nkoropka
Copy link

@nkoropka nkoropka commented Feb 9, 2026

Copy link

@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 still two functional gaps that affect the core task requirements. First, in src/scripts/main.js, the name field is currently taken from item.textContent.trim(), which will include all text inside the <li> (name, position, salary, age), so the employee.name values will be incorrect; instead, you should query the specific element that holds the name (for example item.querySelector('.name').textContent.trim()). Second, you call getEmployees(employeeList) but do not store or expose its return value, while the task explicitly requires obtaining an array of employees that tests/other code can access; fix this by assigning it to a variable such as const employees = getEmployees(employeeList); (or otherwise exposing it, e.g., attaching to window). These two points are critical because they directly impact the correctness of the employee objects and the ability of tests to verify your implementation.

On the positive side, you’ve correctly implemented parseSalary, sortList (with descending salary sort and re-append), and getEmployees with proper extraction of position, salary, and age, which shows solid understanding of the DOM and data transformation parts of the task. Once you adjust the name extraction and make the employees array accessible, your solution should fully meet the requirements. Keep going—you’re very close to a complete and robust 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


return items.map((item) => {
return {
name: item.textContent.trim(),

Choose a reason for hiding this comment

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

name is taken from item.textContent.trim() which will include all text inside the <li> (name plus other fields). This likely produces incorrect name values. Extract the name from the specific element (for example item.querySelector('.name').textContent.trim()) instead.


sortList(employeeList);

getEmployees(employeeList);

Choose a reason for hiding this comment

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

You call getEmployees(employeeList) but do not store its return value. The task requires getting an array of employees — assign the result to a variable (e.g. const employees = getEmployees(employeeList);) or otherwise expose it so the array is available for tests/usage.

Copy link

@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 two core functional requirements are not yet fully met, and they will cause tests to fail. First, in src/scripts/main.js, the name field for each employee is currently extracted from the entire <li> text (e.g., something like item.childNodes[0].textContent.trim()), which can include extra content and does not reliably reflect just the employee’s name; the requirement is that employee.name come from the specific name element, so you should instead query that element directly (for example, item.querySelector('.name').textContent.trim() or the class used in the markup). Second, although getEmployees(list) correctly builds an array of employee objects, its return value is discarded, so tests have no way to access the resulting array; you need to store it (e.g., const employees = getEmployees(employeeList);) and then expose it in a way tests can read (for example, attaching it to window.employees if that matches the task’s testing pattern). These two issues are critical because they break the required employee schema ({ name, position, salary, age }) and the “get an array of employees” requirement. Once you fix the name extraction to target the proper DOM element and expose the employees array from getEmployees, your existing parsing and sorting logic should satisfy the remaining requirements. Overall the structure of your solution is solid, so after these adjustments it should align well with the task and pass the tests.


✨ 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

Copy link

@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

Excellent work on this iteration! I'm happy to approve your solution. You've done a great job addressing the feedback from the last review. The employee name is now being extracted correctly, and the employees array is properly stored and accessible, which is perfect for testing. Your code is clean, correct, and now fully meets all the task requirements. Keep up the great work!


✨ 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