Skip to content

added new task solution - #1887

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

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

Conversation

@Marfo0

@Marfo0 Marfo0 commented Sep 11, 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

I am requesting changes because the table row is appended to the table multiple times per person, which breaks the required structure. The requirement is to create one <tr> per person with 6 <td> cells and append that row once after all cells are created; currently the code appends the row after creating each cell, producing duplicate and incomplete rows. Please move all table.append(row) calls so there is only one call at the end of the forEach iteration, after appending the six cells to the row in order: name, gender, born, died, age, century. This change will prevent malformed HTML and align with the checklist item to append the completed row once. The age and century calculations look correct, so focus on fixing the DOM insertion sequence. As a minor cleanup, remove any redundant append calls and consider simplifying the gender mapping if desired. Once adjusted, the dashboard should render correctly and meet the task 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
const cell = document.createElement('td');

cell.textContent = person.name;
row.append(cell);

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 row is being appended to the table after only the first cell (name) is added. The row should only be appended once after ALL 6 cells are created. This causes the row to be added to the table multiple times per iteration.

Comment thread src/scripts/main.js
} else {
genderCell.textContent = 'Female';
}
row.append(genderCell);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue: row is appended prematurely. This is repeated for each cell creation block.

Comment thread src/scripts/main.js
const bornCell = document.createElement('td');

bornCell.textContent = person.born;
row.append(bornCell);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue: row is appended prematurely.

Comment thread src/scripts/main.js
const diedCell = document.createElement('td');

diedCell.textContent = person.died;
row.append(diedCell);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue: row is appended prematurely.

Comment thread src/scripts/main.js
const ageCell = document.createElement('td');

ageCell.textContent = person.died - person.born;
row.append(ageCell);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue: row is appended prematurely.

Comment thread src/scripts/main.js
const centuryCell = document.createElement('td');

centuryCell.textContent = Math.ceil(person.died / 100);
row.append(centuryCell);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Move this line to AFTER all cells are appended to the row. Currently it's the only correct placement, but there should be only ONE table.append(row) call at the end of the forEach iteration, not multiple scattered throughout.

@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. The code correctly implements all requirements: each person gets one table row containing all 6 cells (name, gender, born, died, age, century) appended in the correct order, and table.append(row) is now properly called only once at the end of each iteration. The age calculation (person.died - person.born) and century calculation (Math.ceil(person.died / 100)) are accurate, and the .dashboard table is properly selected. The previous DOM manipulation issue has been resolved, and the table structure is now valid HTML. Great work!


✨ 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