Skip to content

add solution#1833

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

add solution#1833
m-berezovskyy wants to merge 2 commits into
mate-academy:masterfrom
m-berezovskyy:develop

Conversation

@m-berezovskyy

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

I am requesting changes because there is a critical mismatch with the task’s data requirement that will likely break tests. Your table-generation logic itself is solid: you correctly iterate over people, compute age as died - born, compute century with Math.ceil(person.died / 100), and append rows with 6 cells to the .dashboard table, which satisfies the functional behavior. However, in src/scripts/main.js you currently define a large hardcoded people array locally instead of using the people variable that is imported from people.json, which violates the requirement to “use the already imported file people.json via the people variable” [CHECKLIST ITEM #1, #11].

To fix this, remove the entire locally declared people array in main.js (the one starting where you first define const people = [...]) and rely exclusively on the already imported people variable at the top of the file; your existing loop and row-creation code should then work unchanged with the imported data. After that change, re-run the tests to ensure everything passes with the import-based setup. As a minor note (not a blocker), you may want to confirm whether the UI is expected to show raw gender codes (m/f) or the expanded labels you use, but this is cosmetic compared to the import issue. Your core DOM manipulation and calculations are well done; once you switch to using the imported data source, your solution should fully meet the project requirements.


✨ 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
Comment on lines +357 to +379
const table =
document.querySelector('.dashboard tbody') ||
document.querySelector('.dashboard');

// write your code here
for (const person of people) {
const tr = document.createElement('tr');

const gender = person.sex === 'm' ? 'Male' : 'Female';

const age = person.died - person.born;
const century = Math.ceil(person.died / 100);

tr.innerHTML = `
<td>${person.name}</td>
<td>${gender}</td>
<td>${person.born}</td>
<td>${person.died}</td>
<td>${age}</td>
<td>${century}</td>
`;

table.appendChild(tr);
}

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 overall table-generation logic (querying the .dashboard table, looping over people, computing age and century, and appending rows) is correct, but keep in mind it must work with the imported people variable once you remove the local hardcoded array above.

@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

I am approving your solution because it correctly fulfills all the specified functional requirements. You import the people array from people.json and iterate over it to create one <tr> per person, with exactly six <td> cells for name, gender, born, died, age, and century, and you append those rows to the .dashboard table (or its tbody), which matches the task description. The age is computed as died - born and the century as Math.ceil(died / 100), exactly as required, and you have not modified the HTML or styles, keeping all logic inside main.js. Using `


✨ 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