Skip to content

London | ITP-May-25 | Emiliano Uruena | Data-Flows Sprint-2 | Book-Library 📚 #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Emilianouz
Copy link

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

Bug Fixes Implemented in JavaScript and HTML Functionality:

  • View a list of books I've read:

The display function now correctly renders the full list of books stored in memory or local storage. Any updates to the list—such as adding or removing books—are reflected immediately in the user interface.

  • Add new books to the list:

Users can now successfully add books they've read to the list. Each book entry includes:

  • Title
  • Author
  • Number of pages
  • A checkbox to indicate whether the book has been read

All form inputs are now properly validated. If any required field is missing or left empty, the book will not be added, and the system will display an alert message prompting the user to complete all fields. This prevents empty or incomplete entries in the book list.

  • Remove books from the list:

Each book in the list now includes a "Remove" button. When clicked, the corresponding book is deleted from the list both visually and from the underlying data. The removal process has been debugged to ensure that it consistently targets the correct entry without affecting others.

@Emilianouz Emilianouz added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 29, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

According to https://validator.w3.org/, there are errors in your index.html. Can you fix these errors?

Copy link
Author

Choose a reason for hiding this comment

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

You're right: Element title must not be empty. Duplicate ID title. Duplicate ID author.Duplicate ID check. Sorted!

Copy link
Contributor

Choose a reason for hiding this comment

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

According to https://validator.w3.org/, there are still errors in your index.html.

Copy link
Author

Choose a reason for hiding this comment

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

Apologies, I’ve reviewed and resolved it.

Comment on lines 31 to 37
if (
title.value == null ||
title.value == "" ||
author.value == null ||
author.value == "" ||
pages.value == null ||
pages.value == ""
Copy link
Contributor

Choose a reason for hiding this comment

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

In terms of input validation,

  1. Can .value be null? (Do we need to check someInputElement.value == null?)
  2. Do you want to allow book title and author name to contain only space characters?
  3. What if a user enters an invalid page number in the "pages" input field?

Copy link
Author

Choose a reason for hiding this comment

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

Mmm... I didn't think that. Now, I added trim() to check the spaces on title and author. Also, a validator for number of pages.

Comment on lines 100 to 101
alert(`You've deleted title: ${myLibrary[i].title}`);
myLibrary.splice(i, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

The alert message is shown before the book is actually deleted; the deletion only occurs after the alert dialog is dismissed. This introduces a risk that the operation may not complete (e.g., if the user closes the browser before dismissing the alert).

In general, it’s better to display a confirmation message only after the associated operation has successfully completed.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the advice. Sorted.

@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 3, 2025
- Using user input with validation.
- Arguments are pre-processed/sanitize before calling the constructor; removing leading/trailing whitespace
- rows are inserted inside the <tbody>, not the <thead>
Copy link
Author

@Emilianouz Emilianouz left a comment

Choose a reason for hiding this comment

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

@cjyuan Thank you for the feedback on my JavaScript PR; it was very constructive.
Issues solved according to the advices:

  • Using user input with validation.
  • Arguments are pre-processed/sanitize before calling the constructor; removing leading/trailing whitespace
  • rows are inserted inside the , not the

Copy link
Author

Choose a reason for hiding this comment

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

You're right: Element title must not be empty. Duplicate ID title. Duplicate ID author.Duplicate ID check. Sorted!

Comment on lines 31 to 37
if (
title.value == null ||
title.value == "" ||
author.value == null ||
author.value == "" ||
pages.value == null ||
pages.value == ""
Copy link
Author

Choose a reason for hiding this comment

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

Mmm... I didn't think that. Now, I added trim() to check the spaces on title and author. Also, a validator for number of pages.

Comment on lines 100 to 101
alert(`You've deleted title: ${myLibrary[i].title}`);
myLibrary.splice(i, 1);
Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the advice. Sorted.

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

Changes in script.js look good.

  • index.html still have errors (according to W3C validator).

Copy link
Contributor

Choose a reason for hiding this comment

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

According to https://validator.w3.org/, there are still errors in your index.html.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 7, 2025
- Attribute type updated in input for author and title
- Charset and name in separated tags.
- Empty rows on tbody removed.
- html tag with language attribute.
On script: Variable to store name of book  to show the name after it is deleted.
Copy link
Author

@Emilianouz Emilianouz left a comment

Choose a reason for hiding this comment

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

It were reviewed and resolved.

Copy link
Author

Choose a reason for hiding this comment

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

Apologies, I’ve reviewed and resolved it.

@Emilianouz Emilianouz added 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 8, 2025
@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 8, 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. Module-Data-Flows The name of the module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants