Skip to content

Conversation

@nahommesfin77
Copy link

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

I debugged and fixed issues preventing books from displaying. and corrected errors when adding a book. then fixed the title/author mix-up, ensured the delete button works, and corrected the read-status logic. I then implemented validation so incomplete book entries show an alert instead of being added to the list.

@nahommesfin77 nahommesfin77 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 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.

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 Aug 20, 2025
@nahommesfin77
Copy link
Author

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.

Thanks for the reply, I have checked https://github.com/cjyuan/Module-Data-Flows/blob/book-library-feedback/debugging/book-library/feedback.md and made improvements to the code.

@nahommesfin77 nahommesfin77 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 Aug 20, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Aug 20, 2025
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

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

Good work on this sprint. It is almost done. I have left some remarks for how you could improve it further

const authorValue = author.value.trim();
const pagesValue = pages.value.trim();

if (!titleValue || !authorValue || !pagesValue) {

Choose a reason for hiding this comment

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

Are there any values in the form you might want to validate more carefully than just "is there data here"?

Copy link
Author

Choose a reason for hiding this comment

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

yes there are a couple of validation rules i should have added.

line 32

I added a conditon if (!/^[a-zA-Z\s.'-]+$/.test(authorValue) to validate authors value, limiting it to only letters, spaces, periods, apostrophes, and hyphens.

line 38

I added another condition for page number if (!Number.isInteger(pagesNumber) || pagesNumber <= 0) to validate only postive numbers.

deleteButton.addEventListener("click", () => {
myLibrary.splice(i, 1); // delete immediately
render(); // update the table
alert(`Deleted "${book.title}" successfully.`); // optional confirmation

Choose a reason for hiding this comment

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

When you are deleting something like a file on your PC, do you normally expect to be notified after, or is there an interaction that would work that is better than alert?

Copy link
Author

Choose a reason for hiding this comment

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

line 22 - 35

Instead of blocking alerts, i have used a notification function function showNotification(message) which gives a non interrputing visually nicer notification instead of popup alert.

<label for="title">Title:</label>
<input
type="title"
type="text"

Choose a reason for hiding this comment

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

Right now you need to manually validate the form. Do you know what change you need to make to the HTML and script to make the browser validate the form inputs automatically?

Copy link
Author

Choose a reason for hiding this comment

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

lines 47 & 56

I have removed the some of the manual validations i used earlier in the script and replaced it with an autotmatic error handler in my html for the inputs pattern="[a-zA-Z\s.'-]+" , required min="1"

@LonMcGregor LonMcGregor 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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 20, 2025
@nahommesfin77 nahommesfin77 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 Aug 20, 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 changes you made look good. You can go through my additional suggestions later when you have time.

Comment on lines +47 to +48
pattern="[a-zA-Z\s.'-]+"
title="Only letters, spaces, apostrophes, periods, or hyphens allowed"
Copy link
Contributor

Choose a reason for hiding this comment

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

This approach is good but the pattern might be too restrictive.

Comment on lines +32 to +35
document.getElementById("bookForm").addEventListener("submit", function(event) {
event.preventDefault();
submit();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Placing code that's to be executed once on page load (lines 3-6, 32-35) together could make locating this kind of code easier.

Comment on lines +54 to +57
title.value = "";
author.value = "";
pages.value = "";
check.checked = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

We could also use .reset() of a form element to clear the form.

myLibrary.splice(i, 1);
render();
// Delete button
const deleteCell = row.insertCell(4);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you think of the pros and cons of these two approaches for creating cells within a row?

  • Keeping all the cell creation code in one location, like the original code does.
  • Scattering the cell creation code across different locations, like what you did.

@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 Aug 20, 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.

4 participants