Skip to content
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

London | Emmanuel Gessessew | Module-Data-Flows| WEEK 2 Book library project #124

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

Conversation

Emmanuelgessessew
Copy link

Learners, PR Template

Self checklist

  • [ yes] I have committed my files one by one, on purpose, and for a reason
  • [yes ] I have titled my PR with COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • [ yes] I have tested my changes
  • [ yes] My changes follow the style guide
  • [ yes] My changes meet the requirements of this task

Changelist

Briefly explain your PR.
Correcting input validation before adding books.
Using myLibrary instead of library.
Fixing title/author mismatch.
Ensuring the delete button works.
Correctly saving the "read" status.

Questions

Ask any questions you have for your reviewer.

@Emmanuelgessessew Emmanuelgessessew added the Needs Review Participant to add when requesting review label Jan 5, 2025
@OracPrime OracPrime added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jan 8, 2025
@OracPrime
Copy link

It's always a good habit to try to use your code as an end user just before you submit a PR. In particular, there's the "does it work" test. In particular have you tried submitting books with different values of "Checked" for whether it was read or not. Or indeed does it look right for your initial two books? Can you see the problem here?

@OracPrime
Copy link

I also when possible try to look at the diff of each changed file I submit, as this sometimes makes bugs more obvious than looking at the entire code. For example my previous comment might be most easily addressed by looking at 7239a23 and seeing if anything leaps off the page at you!

@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5502

Choose a reason for hiding this comment

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

There is debate as to whether you should commit your .vscode file to version control. Generally it is things related to your own personal setup, and you don't want to force other users to share them. Google .gitignore to discover how to exclude files or folders from version control.

Sometimes you do want local configuration to be shared, but only do it intentionally!


titleCell.innerHTML = myLibrary[i].title;
authorCell.innerHTML = myLibrary[i].author;
pagesCell.innerHTML = myLibrary[i].pages;

Choose a reason for hiding this comment

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

I'm pretty sure your code wasn't working when you made this commit, because there are a whole bunch of missing } at the end (which show up in the next commit). It's generally considered prudent to have committed code in a reasonable state of "cleanness" as others may check it out and try to use it. Less of an issue on a branch that only you are using, but something to bear in mind

Copy link

@OracPrime OracPrime left a comment

Choose a reason for hiding this comment

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

Very close, but a few areas where improvement and/or increased understanding is possible

// Insert updated rows and cells
let length = myLibrary.length;
for (let i = 0; i < length; i++) {
let row = table.insertRow(1);

Choose a reason for hiding this comment

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

What does the 1 argument do here? How does the result differ if you leave it out? Which do you prefer?

@@ -7,7 +7,7 @@ window.addEventListener("load", function (e) {

function populateStorage() {
if (myLibrary.length == 0) {
let book1 = new Book("Robison Crusoe", "Daniel Defoe", "252", true);
let book1 = new Book("Robinson Crusoe", "Daniel Defoe", "252", true);

Choose a reason for hiding this comment

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

This is a good correction. Having accurate test data in software helps users and testers take it more seriously. So well done for bothering to correct this.

});
// Add a delete button to every row and render again
let delButton = document.createElement("button");
delButton.id = i + 5;

Choose a reason for hiding this comment

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

What is this delButton.id = i+5 doing?

});
}
delButton.addEventListener("click", function () {
alert(`You've deleted title: ${myLibrary[i].title}`);

Choose a reason for hiding this comment

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

Explain to me where the value for i comes from here?

alert(`You've deleted title: ${myLibrary[i].title}`);
myLibrary.splice(i, 1);
render();
});

Choose a reason for hiding this comment

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

If you can set a formatter such as prettier up on your vscode, you'll be able to easily format the source file so that the structure is clearer.

@OracPrime OracPrime 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. Needs Review Participant to add when requesting review labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants