Skip to content

Conversation

@shaghayeghfar
Copy link

Learners, PR Template

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

I fixed the errors and fixed the add button.

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

Can you check if any of this general feedback can help you further improve your code? https://github.com/cjyuan/Module-Data-Flows/blob/book-library-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 Dec 6, 2025
@shaghayeghfar
Copy link
Author

Dear @cjyuan

thank you for reviewing my code, I did some changes to my code.
thank you for your time and help .

@shaghayeghfar shaghayeghfar requested a review from cjyuan December 6, 2025 15:46
@shaghayeghfar shaghayeghfar 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 Dec 6, 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.

Everything looks great so far! I only have a couple of small follow-ups.

const pages = pagesInput.value;

// FEEDBACK APPLIED: improved validation and normalization
if (!title || !author || !pages || Number(pages) <= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

A lot of numbers that should probably be treated as invalid page counts could pass this check.
Can you reject or post-process these numbers?

Copy link
Author

Choose a reason for hiding this comment

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

thanks again for your feedback
I improved the page number check so it only lets real, positive whole numbers through. It now removes extra spaces, makes sure the value is actually a number, doesn’t allow decimals or negative numbers, and also blocks extremely large page counts.

clearForm();

// Collapse form
$("#addForm").collapse("hide");
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use mixed syntax in manipulating DOM? It is generally not commended for new project.

Note: Do you recognize what 3rd party dependency is needed in order for this statement to work?

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.
I replaced the jQuery collapse line with the Bootstrap 5 JavaScript API, so the form now closes using only plain JavaScript. This removes the jQuery dependency and keeps the code consistent with the rest of the project.

const collapse = bootstrap.Collapse.getOrCreateInstance(document.getElementById("addForm"));
collapse.hide();

$("#addForm").collapse("hide");
}

addBtn.addEventListener("click", submitBook);
Copy link
Contributor

Choose a reason for hiding this comment

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

Putting the code on line 84 and the code on lines 28-29 (code that is executed once on page load) in one place could make it easier to understand what’s happening when the page loads.

Copy link
Author

@shaghayeghfar shaghayeghfar Dec 8, 2025

Choose a reason for hiding this comment

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

thank you . I moved all the code that runs when the page loads (loading the library, rendering the table, and setting up the add button) into one DOMContentLoaded block. This makes it easier to see what happens on page load.

@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 Dec 7, 2025
@shaghayeghfar shaghayeghfar requested a review from cjyuan December 8, 2025 22:57
@shaghayeghfar shaghayeghfar 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 Dec 8, 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.

Great work!

!Number.isInteger(pagesNum) ||
pagesNum <= 0 ||
pagesNum > 10000 || // reject unrealistic values
!isFinite(pagesNum) // rejects Infinity and NaN
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the checks on line 67, 68, 71 are redundant. Can you figure out which?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants