Skip to content

add task solution#1994

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

add task solution#1994
sqw1830 wants to merge 2 commits into
mate-academy:masterfrom
sqw1830:develop

Conversation

@sqw1830
Copy link
Copy Markdown

@sqw1830 sqw1830 commented May 28, 2026

solution

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

The sorting functionality works correctly, but changes are needed because the code doesn't follow the explicit task requirements. The task requires three specific function implementations: a getEmployees function that returns an array of employee objects with the schema { name, position, salary, age }, a sortList function that takes a list parameter, and a separate helper function for converting salary strings to numbers. Currently, the code has inline logic instead of these required named functions. Additionally, both functions must be called as per step 4 of the requirements. Please refactor the code to use the required function structure, and also update the README demo link (replace <your_account> with your actual GitHub username).


✨ 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
const listChildren = document.querySelectorAll('li');
const ArrayListChildren = [...listChildren];

ArrayListChildren.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 code sorts the list inline but is missing the required sortList function. The task specifies creating a function that takes a list property and sorts list items by salary.

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

list.innerHTML = '';
ArrayListChildren.forEach((li) => list.appendChild(li));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing the required getEmployees function. This function must return an array of employee objects with the schema { name, position, salary, age }.

Comment thread src/scripts/main.js Outdated
const cleanA = a.dataset.salary.replace(/[$,]/g, '');
const cleanB = b.dataset.salary.replace(/[$,]/g, '');

const salaryA = Number(cleanA);
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 a helper function for number conversion (converting salary string to number). Currently the conversion is done inline within the sort logic.

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

list.innerHTML = '';
ArrayListChildren.forEach((li) => list.appendChild(li));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing function calls. After defining sortList and getEmployees, both functions need to be called as per the task requirements (step 4).

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

The provided response is not valid JSON. It contains markdown text and formatting that is not part of the expected JSON structure. The correct JSON should only include the 'decision' and 'reason' fields as defined in the schema, with 'decision' being either 'APPROVE' or 'REQUEST_CHANGES', and 'reason' being a string explaining the decision.


✨ 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
return Number(cleanString);
}

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.

CHECKLIST ITEM #7 VIOLATION: The getEmployees function must take a list parameter as required by the task. Currently it queries ul li directly instead of using the parameter. Update the function signature to function getEmployees(list) and use list.querySelectorAll('li') instead.

Comment thread src/scripts/main.js
Comment on lines +14 to +20
return {
element: li,
name: li.textContent.trim(),
position: li.dataset.position,
salary: li.dataset.salary,
age: Number(li.dataset.age),
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CHECKLIST ITEM #8 VIOLATION: The employee object schema must be exactly { name, position, salary, age } without the extra element property. Remove the element: li line from the returned object.

Comment thread src/scripts/main.js

const listElement = document.querySelector('ul');

sortList(listElement);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CHECKLIST ITEM #9 VIOLATION: Both functions must be explicitly called. Currently only sortList is called at the end. Add a call to getEmployees(listElement) to store the employees array in a variable (e.g., const employees = getEmployees(listElement);).

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