-
Notifications
You must be signed in to change notification settings - Fork 0
Student reviews API (#33) #40
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- studentRating and reviews each run their own query for every wine. A 50-wine page that asks for both makes about 100 extra queries that are unnecessary.
- Review.wine: it also runs one query per review. It can crash, because it calls toWine(rows[0]) without checking that the wine was found.
- authorName can only produce 9000 different names. The chance of overlapping names is very high on a large dataset. Student #4821 is fine, but should be deterministic at least to support 9k students at the minimum
|
Thanks, all three are fixed: studentRating and reviews now use DataLoader, so a page of wines runs one query per field instead of one per wine. Review.wine also uses DataLoader, and gives a clear error instead of crashing if the wine is missing. Students are now stored in their own table with a unique number, so the names are “Student #1”, “Student #2” and so on, with no limit and no collisions. The review migration is changed, since it is not merged yet. If you ran it locally, run npm run db:migrate:down before pulling and npm run db:migrate after. |
The merge-base changed after approval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Approved to merge with main.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Re-approving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good.
The merge-base changed after approval.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trying to approve again
Closes #33. Depends on #39 (migrations), so merge that first.
Tested locally: saving, updating, deleting, recent reviews and invalid input. 35 backend tests pass, typecheck passes.
After merging: run npm ci and npm run db:migrate in backend/ on the VM, then restart the backend.