Skip to content

GLASGOW | DATA FLOWS | AIDA ZHUKOVA | BOOK LIBRARY #202

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 4 commits into
base: main
Choose a base branch
from

Conversation

aidazhukova
Copy link

@aidazhukova aidazhukova commented Apr 16, 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.

@aidazhukova aidazhukova added the Needs Review Participant to add when requesting review label Apr 16, 2025
@cjyuan cjyuan added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Participant to add when requesting review labels Apr 17, 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.

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

Code works, but there are some improvements you can still make.

Comment on lines 31 to 38
if (
title.value == null ||
title.value == "" ||
pages.value == null ||
pages.value == ""
pages.value == null ||
pages.value == "" ||
author.value == null ||
author.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 accept books to appear in the app as shown in this pic:
    image

Comment on lines +61 to 63
for (let n = rowsNumber - 1; n > 0; n--) {
table.deleteRow(n);
}
Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

  • Lines 79, 97:

    • Are the values assigned to these id attributes unique?
    • Is there any need to assign an id attribute to either buttons?
  • Line 73:

    • 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.
  • Can you think of a more consistent way to name the variables representing the two buttons, changeBut and delButton?

@@ -53,8 +55,10 @@ function Book(title, author, pages, check) {
function render() {
let table = document.getElementById("display");
let rowsNumber = table.rows.length;
console.log(myLibrary)
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is for debugging/testing purpose, we should remove it from the "final product".

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 17, 2025
@aidazhukova
Copy link
Author

Thank you for review, @cjyuan . I've made some changes. Thanks

@cjyuan
Copy link
Contributor

cjyuan commented Apr 17, 2025

In terms of input validation

  1. Do you accept values like " " as book title and author name?
  2. What if a user enters an invalid page number in the "pages" input field?

All the other changes look good.

@aidazhukova
Copy link
Author

I've made some changes. About invalid number - I added in HTML type- number and minimum value:1. Now it accepts only positive numbers.

@cjyuan
Copy link
Contributor

cjyuan commented Apr 18, 2025

What if a user enters 3.1416 as page number?

@aidazhukova
Copy link
Author

Thanks I changed it.

@cjyuan
Copy link
Contributor

cjyuan commented Apr 18, 2025

Looks good. You could also set up the HTML element to accept only integer.

Anyway, feel free to label this PR "Complete".

@aidazhukova
Copy link
Author

Ok. Thank you.

@aidazhukova aidazhukova added the Complete Volunteer to add when work is complete and review comments have been addressed label Apr 18, 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 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.

2 participants