Conversation
📝 HackYourFuture auto gradeAssignment Score: 0 / 100 ✅Status: ✅ Passed Test Details |
There was a problem hiding this comment.
Well done with the implementation! And all results are working well!
Another point that is good is the commit messages - very clear on what you had done and the steps of your development. This makes clear for other developer to review your code.
Tip for next time is create a branch with the name of the assignement (e.g week-12-assignement). Usually you keep in main your last version and your proposal to change goes in a branch that will be merged in main ;)
Happy to help you if you have any doubt about my comments!
| ORDER BY b.published_year ASC; | ||
|
|
||
| -- **Question 5** — Add yourself as a new author. Use your real name, or make one up. Pick any nationality and birth year. | ||
| SELECT * FROM authors; |
There was a problem hiding this comment.
This SELECT doesn't show the line inserted below. How would you check that it worked porperly?
| INSERT INTO books (title, author_id, genre, published_year) | ||
| VALUES ( | ||
| 'Potatos Adventure', | ||
| (SELECT id FROM authors WHERE first_name = 'Bader' LIMIT 1), |
There was a problem hiding this comment.
Good approach on this one on not to add the author_id directly but search in the database. But I have a question: If there is a author name as Aaron Bader, who would you think that would get this new book? Aaron Bader or Almsaddi Bader?
| -- **Question 7** — The genre for "The Dark Tower: The Gunslinger" was entered incorrectly as `'Fantasy'`. It should be `'Horror'`. Write an UPDATE to fix it, then verify the change with a SELECT. | ||
| UPDATE books | ||
| SET genre = 'Horror' | ||
| WHERE title LIKE '%Gunslinger%'; |
There was a problem hiding this comment.
Consider the requests and the data possibility that you can have in your table is important. A query without consider this aspects could affect unrelated data.
What would happen with the book Phantom Gunslinger with this query?
| // TODO: return all rows from the decks table | ||
| throw new Error('Not implemented'); | ||
| return db.prepare("SELECT * FROM decks").all(); | ||
| throw new Error("Not implemented"); |
There was a problem hiding this comment.
This throw would never be executed, so what do you think of removing them? Unless you want to throw an expecific Error message if an error happened in database (check Week 10 :D )
| for (const card of data.cards) { | ||
| insertCard.run({ | ||
| ...card, | ||
| learned: card.learned ? 1 : 0, |
There was a problem hiding this comment.
Use of ternary operator saves a lot of code for condition check. Well done!
No description provided.