Skip to content

Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2|Book Library#448

Open
mjm-git185 wants to merge 5 commits intoCodeYourFuture:mainfrom
mjm-git185:leBibliateca
Open

Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2|Book Library#448
mjm-git185 wants to merge 5 commits intoCodeYourFuture:mainfrom
mjm-git185:leBibliateca

Conversation

@mjm-git185
Copy link
Copy Markdown

Changelist

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
my coursework

@github-actions

This comment has been minimized.

@mjm-git185 mjm-git185 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 16, 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 Apr 16, 2026
@mjm-git185 mjm-git185 changed the title Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2| libreiy Glasgow | 26-ITP-Jan| Martin McLean |Sprint 2|Book Library Apr 16, 2026
@mjm-git185 mjm-git185 added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 16, 2026
Copy link
Copy Markdown
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.

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

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

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.

Thanks this site was very helpful

Comment thread debugging/book-library/script.js Outdated
@@ -1,100 +1,101 @@
let myLibrary = [];
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.

Safer to declare this using const.

Comment thread debugging/book-library/script.js Outdated
Comment on lines +26 to +30
const titleInput = document.getElementById("title").value;
const authorInput = document.getElementById("author").value;
const pagesInput = document.getElementById("pages").value;
const checkInput = document.getElementById("check").checked;
if (titleInput == "" || pagesInput == "" || authorInput == "") {
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.

  • .value is a string. As such, pagesInput could be a number in scientific format (e.g. "3e2").

  • What is an acceptable range of page count?

  • Should the app be accepting a string containing only spaces (e.g. " ") as the title or author of the book?

Comment thread debugging/book-library/script.js Outdated
Comment on lines +38 to +32
return false;
return true;
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 return true when some of the input fields is empty?

Comment thread debugging/book-library/script.js Outdated
Comment on lines 37 to 38
//clear the input values
}
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 is this comment about?

Comment thread debugging/book-library/script.js Outdated
authorCell.innerHTML = myLibrary[i].author;
pagesCell.innerHTML = myLibrary[i].pages;

//deleteCell.innerHTML = button[i]
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.

You should delete all unnecessary code instead of keeping them in a comment.

Comment thread debugging/book-library/script.js Outdated
Comment on lines +79 to +82
myLibrary[i].check == true
? (readStatus = "Yes")
: (readStatus = "No");

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.

Normally way to use ? : is:

readStatus = myLibrary[i].check ? "Yes" : "No";

  • condition ? v1 : v2 is an expression. It evaluates to v1 if condition is true, and to v2 if condition is false.
  • .check is a boolean value. Comparing it to true is optional.

Comment thread debugging/book-library/script.js Outdated
Comment on lines +86 to +88
myLibrary[i].check == true
? (myLibrary[i].check = false)
: (myLibrary[i].check = true);
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.

This can be simplified into
myLibrary[i].check = !myLibrary[i].check;

Comment thread debugging/book-library/script.js Outdated
delBut.innerHTML = "Delete";
delBut.addEventListener("clicks", function () {
const button = document.createElement("button");
button.id = i;
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.

  • Lines 74, 94:
    • Are the values assigned to these id attributes unique?
    • Is there any need to assign an id attribute to either buttons?

Comment thread debugging/book-library/script.js Outdated
Comment on lines 99 to 101
alert(`You've deleted title: ${myLibrary[i].title}`);
myLibrary.splice(i, 1);
render();
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.

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.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 2026
@mjm-git185 mjm-git185 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants