Skip to content

Conversation

@Fithi-Teklom
Copy link

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

@Fithi-Teklom Fithi-Teklom added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 16, 2025
@github-actions
Copy link

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 16, 2025
@github-actions
Copy link

Your PR couldn't be matched to an assignment in this module.

Please check its title is in the correct format, and that you only have one PR per assignment.

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@Fithi-Teklom Fithi-Teklom changed the title Manchester| 25-ITP-SEP| Fithi Teklom| Sprint-1 | Book Library Manchester| 25-ITP-SEP| Fithi Teklom| Sprint 2 | Book Library Dec 16, 2025
@Fithi-Teklom Fithi-Teklom added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 17, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Can you check if any of this general feedback can help you further improve your code?
https://github.com/cjyuan/Module-Data-Flows/blob/book-library-feedback/debugging/book-library/feedback.md

Doing so can help me speed up the review process. Thanks.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 17, 2025
@Fithi-Teklom Fithi-Teklom added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 18, 2025
Comment on lines 30 to 33
if (!title.value.trim() || !author.value.trim() || !pages.value.trim()) {
alert("Please fill all fields!");
return false;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation is off.

library.push(book);
render();
}
let book = new Book(title.value.trim(), author.value.trim(), pagesNumber, check.checked);
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Could consider saving preprocessed and sanitised input in some variables first to

    • improve performance
    • to avoid accidently using raw input later
  • Not all integers are valid number of pages.

Comment on lines 66 to 67
let pagesCell = row.insertCell(2);
let wasReadCell = row.insertCell(3);
Copy link
Contributor

Choose a reason for hiding this comment

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

If a variable is not going to be reassigned a value, it is best practice to declare the variable using const.

Comment on lines 78 to 85
let readStatus = "";
if (myLibrary[i].check == false) {
if (myLibrary[i].check == true) {
readStatus = "Yes";
} else {
readStatus = "No";
}
changeBut.innerText = readStatus;
toggleReadBtn.innerText = readStatus;
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be a good opportunity to practice using the ? : conditional operator. Can you rewrite the code on lines 79–85 as a single statement?

deleteBtn.dataset.index = i;
deleteCell.appendChild(deleteBtn);
deleteBtn.className = "btn btn-warning";
deleteBtn.innerHTML = "Delete";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why assign text to a DOM element via three different properties?

  • 'textContent` on line 71
  • innerText on line 85
  • innerHTML on line 97

changeBut.className = "btn btn-success";
wasReadCell.appendChild(changeBut);
let toggleReadBtn = document.createElement("button");
toggleReadBtn.dataset.index = i;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the purpose of this statement? Where is the assigned value used in your code?

Comment on lines 57 to 59
for (let n = rowsNumber - 1; n > 0; n-- ) {
table.deleteRow(n);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could consider using a more efficient approach to clear the table.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 18, 2025
@Fithi-Teklom Fithi-Teklom added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 19, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

The most recent changes look good, but they may have introduced a bug in the app.

Can you try adding a new book through the UI and see if the book list is still rendered correctly?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 19, 2025
@Fithi-Teklom Fithi-Teklom added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Dec 19, 2025
@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants