Skip to content

Birmingham | 26-ITP-May | Tobias Amaechina | Sprint 2 | Book-library - #516

Open
Tobias-Amaechina wants to merge 26 commits into
CodeYourFuture:mainfrom
Tobias-Amaechina:book-library
Open

Birmingham | 26-ITP-May | Tobias Amaechina | Sprint 2 | Book-library#516
Tobias-Amaechina wants to merge 26 commits into
CodeYourFuture:mainfrom
Tobias-Amaechina:book-library

Conversation

@Tobias-Amaechina

@Tobias-Amaechina Tobias-Amaechina commented Aug 5, 2026

Copy link
Copy Markdown

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

Changelist

Corrected validation logic to ensure title, author, and pages fields are required before adding a book.

Fixed bug where the author field was ignored and replaced with the title value.

Corrected array reference (library → myLibrary) to prevent runtime errors when adding books.

Repaired table‑rendering loop by fixing a missing parenthesis in the row‑deletion logic.

Corrected read/unread status logic so check === true displays “Yes”.

Fixed delete‑button creation:

Corrected variable name (delButton instead of delBut)

Removed accidental reassignment of the button element

Corrected event listener from "clicks" to "click"

Ensured delete action removes the correct book and re-renders the table

@Tobias-Amaechina Tobias-Amaechina added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 5, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 5, 2026
@Tobias-Amaechina Tobias-Amaechina added 🏕 Priority Mandatory This work is expected Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 5, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 5, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@Tobias-Amaechina Tobias-Amaechina changed the title Birmingham | 26-ITP-May | Tobias Amaechina Sprint 2 | Book-library Birmingham | 26-ITP-May | Tobias Amaechina | Sprint 2 | Book-library Aug 5, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@Tobias-Amaechina Tobias-Amaechina added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected and removed 🏕 Priority Mandatory This work is expected labels Aug 5, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

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/CodeYourFuture/Module-Data-Flows/blob/general-review-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 6, 2026
@Tobias-Amaechina

Copy link
Copy Markdown
Author

Thank you CY for the link , it definitely helped and the HTML has been validated , Thanks

@Tobias-Amaechina Tobias-Amaechina added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected and removed 🏕 Priority Mandatory This work is expected labels Aug 10, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 10, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@Tobias-Amaechina Tobias-Amaechina added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 10, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 10, 2026
@Tobias-Amaechina Tobias-Amaechina added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected and removed 🏕 Priority Mandatory This work is expected labels Aug 10, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes look good.

I only have a few more possible improvements for you to consider.

Comment thread debugging/book-library/index.html
Comment thread debugging/book-library/index.html Outdated
value="Submit"
class="btn btn-primary"
onclick="submit();"
onclick="handleSubmit();"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: Look up the trade-off among different approaches for attaching event listener to HTML elements. In particulars,

  • Via HTML attribute in HTML
  • In JS, using .addEventListener()

let book = new Book(title.value, title.value, pages.value, check.checked);
library.push(book);
render();
if (!title || !author || !pages || pages <= 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What type of number should pages be? Could it be NaN?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Although the HTML is prepared to reject non positive whole number, it is a safer practice to also fully check the input in JS code to ensure it is a positive whole number.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 11, 2026
@Tobias-Amaechina Tobias-Amaechina added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected and removed 🏕 Priority Mandatory This work is expected labels Aug 12, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes look good.

Comment on lines 59 to 66
@@ -62,13 +65,13 @@ <h1>Library</h1>
/>Read
</label>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you notice the checkbox is not showing in the form?
The issue is related to Bootstrap 4.4.1 and AI can point out a solution if you show the code to it (and mention the code uses Bootstrap 4.4.1)

Fixing this is optional.

}

// attach listener
document.getElementById("submit-btn").addEventListener("click", handleSubmit);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could consider placing all code that runs once on page load in a single function. For example, you could put it inside the page load callback or create a function named init() or setup() and call it once when the page loads.

This makes it easier to locate and manage all the code that runs once when the app starts.

const check = document.getElementById("check");
// Handle form submission
function handleSubmit(e) {
e.preventDefault();//stop the form from reloading the page

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note: This method does not stop the page from reloading directly. It stops something else that makes the browser from loading a new page. It's an important method to understand.

let book = new Book(title.value, title.value, pages.value, check.checked);
library.push(book);
render();
if (!title || !author || !pages || pages <= 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Although the HTML is prepared to reject non positive whole number, it is a safer practice to also fully check the input in JS code to ensure it is a positive whole number.

@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 12, 2026
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. 🏕 Priority Mandatory This work is expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants