Skip to content

Develop - #2069

Open
Marfo0 wants to merge 6 commits into
mate-academy:masterfrom
Marfo0:develop
Open

Develop#2069
Marfo0 wants to merge 6 commits into
mate-academy:masterfrom
Marfo0:develop

Conversation

@Marfo0

@Marfo0 Marfo0 commented Sep 8, 2026

Copy link
Copy Markdown

@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 has critical issues that prevent it from meeting the task requirements. Both sortList and getEmployees functions must accept a list parameter as explicitly specified in the requirements, but both currently have zero parameters and instead query the DOM internally. Additionally, the task requires you to 'Call both functions' and to 'write helper function for it' for salary conversion - neither of these has been implemented. The ESLint no-unused-vars errors occur because the functions are never called, which is a direct consequence of not following the required function signatures. To fix this: 1) Add list parameter to both functions, 2) Use the passed list parameter instead of document.querySelector internally, 3) Call both functions after defining them, and 4) Extract the salary conversion logic into a helper function as required. The core sorting and employee extraction logic appears sound, so once these structural issues are addressed, the implementation should work correctly.


✨ 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
@@ -1,3 +1,33 @@
'use strict';
function sortList() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function sortList should take a list parameter as specified in requirements, but currently has no parameters.

Comment thread src/scripts/main.js Outdated
@@ -1,3 +1,33 @@
'use strict';
function sortList() {
const list = 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.

The list parameter should be used here instead of querying the DOM again. Currently queries document.querySelector('ul') internally instead of using the passed parameter.

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

function getEmployees() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function getEmployees should take a list parameter as specified in requirements, but currently has no parameters.

Comment thread src/scripts/main.js Outdated
}

function getEmployees() {
const workers = [...document.querySelectorAll('li[data-salary]')];

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 should be used here instead of querying the DOM. The function should work with the passed list parameter to extract employees.

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

// write code here

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Per requirements: 'Call both functions.' - The functions need to be called. The comment 'write code here' suggests this is where the calls should be added.

Comment thread src/scripts/main.js Outdated
const workers = [...document.querySelectorAll('li[data-salary]')];

workers.sort((a, b) => {
const salaryA = Number(a.dataset.salary.slice(1).split(',').join(''));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Consider creating a helper function for salary conversion (as mentioned in requirements: 'write helper function for it') since the salary parsing logic is duplicated in both functions.

@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 requires changes to meet the task requirements. The sortList and getEmployees functions must accept a list parameter as an argument rather than querying document.querySelector('ul') internally. Additionally, the task requires a named helper function for salary conversion (e.g., getSalary(element)), but this is currently missing and the salary parsing logic is duplicated across your code. Please refactor sortList and getEmployees to accept the list element as a parameter and extract the salary parsing into a reusable helper function.


✨ 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
@@ -1,3 +1,36 @@
'use strict';
function sortList() {

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 sortList function must accept a list parameter as specified in the requirements. Currently it has zero parameters but queries the DOM internally instead of using a passed parameter.

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

function getEmployees() {

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 must accept a list parameter as specified in the requirements. Currently it has zero parameters but queries the DOM internally instead of using a passed parameter.

Comment thread src/scripts/main.js Outdated
Comment on lines +7 to +8
const salaryA = Number(a.dataset.salary.slice(1).split(',').join(''));
const salaryB = Number(b.dataset.salary.slice(1).split(',').join(''));

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 task requires writing a helper function for salary conversion. Currently the salary parsing logic (Number(a.dataset.salary.slice(1).split(',').join(''))) is duplicated. Extract this into a named helper function like getSalary(element).

Comment thread src/scripts/main.js Outdated
Comment on lines +25 to +27
salary: Number(
worker.dataset.salary.slice(1).split(',').join('')
),

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 salary conversion logic is duplicated here. This should use the same helper function mentioned above.

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

sortList();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When calling sortList, pass the list element as an argument (e.g., sortList(list)). The function should use the parameter instead of querying document.querySelector('ul') internally.

Comment thread src/scripts/main.js Outdated
}

sortList();
getEmployees();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When calling getEmployees, pass the list element as an argument. The function should use the passed parameter to query li elements within that list.

@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 solution is approved. All requirements are met: both sortList and getEmployees correctly accept the list parameter as required, the named getSalary helper function properly converts salary strings to numbers, employees are sorted in descending order by salary, and the returned array contains properly structured objects with name, position, salary, and age properties. You also correctly find the list using document.querySelector('ul') and only modify main.js without touching HTML or CSS. Great work implementing these JavaScript DOM manipulation and array methods correctly!

[CHECKLIST ITEMS 1-10 ALL PASS]


✨ 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