Skip to content

London | Nadarajah_Sripathmanathan | book -library | Module-Data-Flows #178

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 9 commits into
base: book-library
Choose a base branch
from

Conversation

sripathman
Copy link

@sripathman sripathman commented Apr 3, 2025

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 COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@sripathman
Copy link
Author

hi,
I have done book-library. please could you review my book-library. Thank you

@sripathman sripathman added the Needs Review Participant to add when requesting review label Apr 5, 2025
Copy link

@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.

I think there are some improvements you can make.

Copy link

Choose a reason for hiding this comment

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

When I checked the code in index.html at https://validator.w3.org/, it indicated some errors.

Copy link

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. Are all input properly checked?
  2. Can .value be null? (Do we need to check someInputElement.value == null?)
  3. What if a user enters only space characters in the "title" input field?
  4. What if a users enters -1 or 3.1416 in the "pages" input field?

With the way the book's title is assigned to an HTML element, a book with a title containing special character sequence such as <i> can possibly ruin the display.

Comment on lines 54 to 56
for (let n = rowsNumber - 1; n > 0; n--) {
table.deleteRow(n);
}
Copy link

Choose a reason for hiding this comment

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

Instead of deleting the table rows one by one, can you think of a more efficient way to remove all rows (except the <th>...</th>) in the table?

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

Choose a reason for hiding this comment

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

At the moment when the alert message is displayed, has the book mentioned in the message been deleted yet?
How would you rearrange these statements to make the message truthful?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Apr 8, 2025
@sripathman sripathman closed this Apr 12, 2025
@sripathman sripathman reopened this Apr 14, 2025
@sripathman sripathman added the Complete Participant to add when work is complete and review comments have been addressed label Apr 19, 2025
@cjyuan cjyuan removed the Complete Participant to add when work is complete and review comments have been addressed label Apr 20, 2025
@cjyuan
Copy link

cjyuan commented Apr 20, 2025

I do not see any changes made to the files.
If you have made changes to your files according to the feedback on your computer, you need to push your changes to Github.

I am removing the "Complete" label for now.

@sripathman sripathman added the Complete Participant to add when work is complete and review comments have been addressed label Apr 21, 2025
@cjyuan
Copy link

cjyuan commented Apr 21, 2025

My feedback was not fully responded.
The input validation still has the same problem.
This branch should only contain files that belong to the book-library project. Please use "git reset" to undo the commits you made.

@cjyuan cjyuan removed the Complete Participant to add when work is complete and review comments have been addressed label Apr 21, 2025
@sripathman sripathman added the Complete Participant to add when work is complete and review comments have been addressed label Apr 21, 2025
Copy link

@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.

Would be better if you can make this branch clean so that it only contains the two modified files that belong to the Book Library task.

Comment on lines +38 to +41
if (titleValue.length === 0) {
alert("Title cannot be just spaces!");
return;
}
Copy link

Choose a reason for hiding this comment

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

This check is redundant.

}

const pagesNumber = parseInt(pagesValue, 10);
if (isNaN(pagesNumber) || pagesNumber < 1 || !Number.isInteger(pagesNumber)) {
Copy link

Choose a reason for hiding this comment

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

You were using parseInt(). Why further check if pagesNumber is integer?


changeReadButton.addEventListener("click", function () {
myLibrary[i].read = !myLibrary[i].read;
changeReadButton.textContent = myLibrary[i].read ? "Yes" : "No";
Copy link

Choose a reason for hiding this comment

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

Could also consider calling render() to update the view to avoid maintaining two sets of code to update view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Participant to add when work is complete and review comments have been addressed Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants