Skip to content

add solution#1998

Open
in4ik1303 wants to merge 5 commits into
mate-academy:masterfrom
in4ik1303:develop
Open

add solution#1998
in4ik1303 wants to merge 5 commits into
mate-academy:masterfrom
in4ik1303:develop

Conversation

@in4ik1303

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 two critical issues that will cause test failures. First, the function is named getEmployers but the task specification requires it to be named getEmployees — this will cause all tests expecting getEmployees to fail with a function not found error. Second, the name extraction uses item.textContent.trim() which retrieves all text content within the list item (name + position + salary + age combined), rather than just the employee name. You need to extract the name from a specific child element, such as using item.querySelector('.name') or item.children[0] to get only the name portion. Once you rename the function to getEmployees and fix the name field extraction to isolate just the name data, your code should 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

Comment thread src/scripts/main.js Outdated
ul.append(...items);
}

function getEmployers(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 task requires the function to be named getEmployees, but this function is named getEmployers. This will cause tests expecting getEmployees to fail.

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

return employers;

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 return statement uses getEmployers instead of getEmployees. This needs to be renamed to match the required function name.

Comment thread src/scripts/main.js Outdated
return employers;
}
sortList(list);
getEmployers(list);

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 call uses getEmployers instead of getEmployees. This needs to match the required function name.

Comment thread src/scripts/main.js

items.forEach((item) => {
employers.push({
name: item.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.

The name field uses item.textContent.trim() which gets all text content from the list item including position, salary, and age. According to the HTML structure, you need to get only the name portion - likely from a child element like item.querySelector('.name') or item.children[0].

@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 code has two critical issues that must be fixed before approval. First, the function is still named getEmployeers (lines 17 and 34) instead of the required getEmployees - this naming mismatch will cause tests expecting getEmployees to fail. Second, there's a runtime error: TypeError: Cannot read properties of null (reading 'textContent') occurring at lines 20-22 in the getEmployeers function. When iterating over DOM elements, your code attempts to access .textContent on an element that doesn't exist. You need to add null checks before accessing .textContent, such as if (element && element.textContent) or ensure the selectors in the forEach loop at line 19 are targeting elements that actually exist in the HTML. These issues will cause the test suite to fail completely, so both must be resolved.


✨ 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
});
ul.append(...items);
}

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 function is named getEmployeers but the task requirement specifies it must be named getEmployees. This will cause test failures. Rename to getEmployees.

Comment thread src/scripts/main.js Outdated
return employers;
}
sortList(list);
getEmployeers(list);

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 function call uses getEmployeers but should match the required function name getEmployees.

@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 correctly implements all task requirements and the code logic is sound. However, I noticed a critical runtime issue from the test failure: the getEmployees function is attempting to access textContent on a null element, which causes a TypeError during the before each hook. This typically means you're trying to access a DOM element that doesn't exist yet. Make sure any elements you're querying with getElementById or querySelector actually exist in your HTML, and consider adding null checks before accessing properties on DOM elements (e.g., if (item) { item.textContent = data.name; }). This is a common issue when working with the DOM and is a great learning opportunity for handling edge cases in real applications. Keep up the good work on the 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

@Denys-Kravchuk9988 Denys-Kravchuk9988 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.

The demo link doesn't work
https://in4ik1303.github.io/js_task_parse_list_DOM/

Please, try to re-deploy the project

Image

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