Skip to content

Conversation

@delmorallopez
Copy link

topics: debugging, DOM
My website should be able to:

View a list of books that I've read
Add books to a list of books that I've read
Including title, author, number of pages and if I've read it
If any of the information is missing it shouldn't add the book and should show an alert
Remove books from my list
Bugs to be fixed
Website loads but doesn't show any books
Error in console when you try to add a book
It uses the title name as the author name
Delete button is broken
When I add a book that I say I've read - it saves the wrong answer
I think there are other some other small bugs in my code...but I'm lazy so I can't fix them all.

I wish somebody would help me!

@delmorallopez delmorallopez added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 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 13, 2025
@delmorallopez
Copy link
Author

Hi @cjyuan
I went through all the debugging feadback points already, please let me know if its missing something
https://github.com/cjyuan/Module-Data-Flows/blob/book-library-feedback/debugging/book-library/feedback.md

Thank you

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

Comment on lines 36 to 42
if (!cleanTitle|| !cleanAuthor) { // title and author doesn't allowed to contain only space characters
alert("Title and Author cannot be empty or spaces only.");
return false;
} else if (isNaN(cleanPages) || cleanPages <= 0) { // the value of type of pages must be a integer
alert("Pages must be a positive whole number.");
return false;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

When an if block contains a return statement, we could choose not to use else.

} else {
let book = new Book(title.value, title.value, pages.value, check.checked);
library.push(book);
let book = new Book(cleanTitle, cleanAuthor, pages.value, check.checked); //// title and author be allowed to contain leading or trailing space characters, we storage using parseInt
Copy link
Contributor

Choose a reason for hiding this comment

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

pages.value could be "3e1" (which could pass the check on line 39).

Copy link
Author

Choose a reason for hiding this comment

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

@cjyuan
I fixed all the errors

table.deleteRow(n);
}
// Keep only the header row
table.innerHTML = table.rows[0].outerHTML;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the <table> also contains a <tbody> child element. The statement on line 60 will remove the <tbody> element.

An alternative approach is the clear <tbody> directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

No change?

Copy link
Author

Choose a reason for hiding this comment

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

I removed from index.html

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 13, 2025
@delmorallopez delmorallopez added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 14, 2025
@github-actions
Copy link

Your PR's title isn't in the expected format.

Please check its title is in the correct format, and update it.

Reason: Sprint part (DATA FLOWS) doesn't match expected format (example: 'Sprint 2', without quotes)

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.

Changes look good.

alert("Title and Author cannot be empty or spaces only.");
return false;

} if (isNaN(cleanPages) || cleanPages <= 0) { // the value of type of pages must be a integer
Copy link
Contributor

Choose a reason for hiding this comment

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

Without else, common practice is to start an if block on a separate line.

alert("Pages must be a positive whole number.");
return false;
}
let book = new Book(cleanTitle, cleanAuthor, pages.value, check.checked); //// title and author be allowed to contain leading or trailing space characters, we storage using parseInt
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use cleanPages? pages.value is a string and can still have leading and trailing space characters.

table.deleteRow(n);
}
// Keep only the header row
table.innerHTML = table.rows[0].outerHTML;
Copy link
Contributor

Choose a reason for hiding this comment

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

No change?

@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 14, 2025
@github-actions
Copy link

Your PR's title isn't in the expected format.

Please check its title is in the correct format, and update it.

Reason: Sprint part (DATA FLOWS) doesn't match expected format (example: 'Sprint 2', without quotes)

2 similar comments
@github-actions
Copy link

Your PR's title isn't in the expected format.

Please check its title is in the correct format, and update it.

Reason: Sprint part (DATA FLOWS) doesn't match expected format (example: 'Sprint 2', without quotes)

@github-actions
Copy link

Your PR's title isn't in the expected format.

Please check its title is in the correct format, and update it.

Reason: Sprint part (DATA FLOWS) doesn't match expected format (example: 'Sprint 2', without quotes)

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.

3 participants