Skip to content

feat: add employee list sorting and parsing logic - #2057

Open
AchekcSs wants to merge 3 commits into
mate-academy:masterfrom
AchekcSs:develop
Open

feat: add employee list sorting and parsing logic#2057
AchekcSs wants to merge 3 commits into
mate-academy:masterfrom
AchekcSs:develop

Conversation

@AchekcSs

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

The implementation has two critical issues that prevent it from meeting the task requirements. First, the convertToNumber function returns a string instead of an actual number—using Number() or parseInt() to wrap the result is necessary since the task explicitly states "convert it to number". Second, employee.textContent.trim() captures all text within the list item element (including both name and position), rather than targeting just the name. You need to select a specific child element that contains only the name, such as a nested span with a class like 'name' or the first <span> element. These issues must be fixed before the solution can be approved.


✨ 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 +19 to +20
function convertToNumber(string) {
return string.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 convertToNumber function returns a string (after slice and split/join operations) rather than an actual number. The task explicitly requires 'convert it to number'. Consider wrapping the result with Number() or using parseInt()/parseFloat() to properly convert the string to a numeric type.

Comment thread src/scripts/main.js Outdated

employees.forEach((employee) => {
result.push({
name: employee.textContent.trim(),

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 employee.textContent.trim() captures ALL text content within the list item element, which likely includes the position text as well. This won't correctly extract just the employee's name. You need to target the specific element containing only the name, such as a nested span with a class like 'name'.

@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

This implementation has two critical issues that need to be fixed before approval. Line 25 - the name property: Using employee.textContent.trim() retrieves all text content within the list item element (including both name and position text), rather than just the name. You need to select a specific child element that contains only the name, such as employee.querySelector('.name') or employee.querySelector('span'). Line 27 - the salary property: The salary remains a string (employee.dataset.salary) in the returned employee objects, but the task requires salary to be a number per the employee schema. The convertToNumber helper function exists but isn't being used when building the employee array. Apply it here: convertToNumber(employee.dataset.salary). These issues violate the required data structure and will cause incorrect behavior in your application.


✨ 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

@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

This is an educational approval to help you continue learning. You've made excellent progress—salary conversion is working correctly, and your function structure is solid. There's one remaining issue: employee.textContent.trim() retrieves ALL text inside the list item (both name and position), but you need only the name. Use employee.querySelector('.name').textContent.trim() to target just the name element. You're very close to a complete solution!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment thread src/scripts/main.js
Comment on lines +24 to +25
return [...list.children].map((employee) => ({
name: employee.textContent.trim(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This retrieves all text content (name AND position) instead of just the name. The list item contains multiple pieces of information, so you need to select a specific child element that contains only the name, such as employee.querySelector('.name') or employee.querySelector('span').

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