Skip to content

London | 26-ITP-May | Martin Mwaka | Sprint 2 | Book library - #523

Open
Temceo wants to merge 8 commits into
CodeYourFuture:mainfrom
Temceo:martin_book_library
Open

London | 26-ITP-May | Martin Mwaka | Sprint 2 | Book library#523
Temceo wants to merge 8 commits into
CodeYourFuture:mainfrom
Temceo:martin_book_library

Conversation

@Temceo

@Temceo Temceo commented Aug 7, 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

Debug and improve functionality of the library app

Temceo added 5 commits August 5, 2026 09:02
…js - update to accept populate table from fragment and refactor to make content easier to understand - style.css - add css for delete book message
@github-actions

This comment has been minimized.

@Temceo Temceo added 🏕 Priority Mandatory This work is expected 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Flows The name of the module. labels Aug 7, 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 7, 2026
@github-actions

This comment has been minimized.

2 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

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

Temceo commented Aug 8, 2026

Copy link
Copy Markdown
Author

I have reviewed the general feedback and improved the code

@Temceo Temceo 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 8, 2026
Comment thread debugging/book-library/index.html
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
Comment on lines +36 to +39
addBookForm.addEventListener("submit", (event) => {
event.preventDefault();
processEntries();
});

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.

To make locating all the "code that is to be executed once on page load" easier, a common practice is to keep the code in the same place. For example, inside the page's onload callback function.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hi, can I please clarify on this point. The addForm event listener only runs each time a new book is added and the processEntries() function validates the inputs before adding the new book. The code that is run on page load is the populateStorage() function which calls the render() function to show all existing books in the library

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have updated the event listeners for window load and add book so hopefully now it is much clearer

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.

  1. Basically all statements written in the top-level scope are code that would be executed once when the HTML page first loaded.
  • Code that attach a callback to a DOM element once usually falls into this category.
  1. Typically we order the code in a file the following manner:
  variable declarations
  
  function definitions
  
  code to be executed (code to be executed once is placed here)
  1. Alternatively, we can place all the code to be executed once on page load inside a function (e.g., init()), and then just call the function.

What you did works.

The code that manages form validation could be better organised but that's out of the scope of this exercise.

Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/script.js Outdated
@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 9, 2026
@Temceo Temceo 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 9, 2026
Comment thread debugging/book-library/script.js
Comment thread debugging/book-library/script.js Outdated
Comment thread debugging/book-library/index.html Outdated
Comment thread debugging/book-library/script.js Outdated
Comment on lines +36 to +39
addBookForm.addEventListener("submit", (event) => {
event.preventDefault();
processEntries();
});

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.

  1. Basically all statements written in the top-level scope are code that would be executed once when the HTML page first loaded.
  • Code that attach a callback to a DOM element once usually falls into this category.
  1. Typically we order the code in a file the following manner:
  variable declarations
  
  function definitions
  
  code to be executed (code to be executed once is placed here)
  1. Alternatively, we can place all the code to be executed once on page load inside a function (e.g., init()), and then just call the function.

What you did works.

The code that manages form validation could be better organised but that's out of the scope of this exercise.

Comment thread debugging/book-library/script.js Outdated
Comment on lines +88 to +127
addBookForm.reset();
addBook.reset();

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.

Why not use the name addBookForm? It makes it clearer that the variable refers to a form element.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have reverted this to addBookForm

@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 9, 2026
@Temceo Temceo 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 9, 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.

pagesInput.value,
trimmedTitle,
trimmedAuthor,
trimmedPages,

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.

Should the .pages property of a book be a number or a string? For this particular simple app it may not matter but it is safer to consistently represent a kind of data using same data type.

@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 10, 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. Module-Data-Flows The name of the module. 🏕 Priority Mandatory This work is expected 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants