Repository navigation
Add drink sizes to orders - #1
Conversation
Each order item takes an optional size: small (50 cents under the menu price), medium (the menu price, and the default), or large (75 cents over). Quoted lines now include the size, and unit_cents is the size-adjusted price. An unknown size returns 422. The ordering page gets a size picker per drink and shows the size on each quoted line.
✅ Agent review: mergingThe PR adds an optional Tested against preview: https://pr-1.brewbar.presto2.clusters.miren.run
|
Biscuit approved an earlier commit and is reviewing the newer ones; it approves again if they earn it.
Biscuit approved an earlier commit and is reviewing the newer ones; it approves again if they earn it.
✅ Agent review: mergingThe PR adds an optional Tested against preview: https://pr-1.brewbar.presto2.clusters.miren.run
|
There was a problem hiding this comment.
🍪 biscuit: ✅ approved — human code review not needed
This is still ready. The only new commit (fdefa63) is another merge of main into drink-sizes, and the PR's own diff is the same as at 58f4cbb.
Nothing that came in with the merge affects sizing:
- The menu prices in
orders.goare unchanged, and espresso at 300¢ is still the cheapest drink, so a small can't price below zero. main.gostill maps every error other thanErrEmptyOrderto a 422, so an unknown size is still rejected that way.quoteOrderstill has a single caller.- The only places that read
size,unit_centsorline_centsfrom a quote are the page, the docs and the tests.DEMO.md,README.mdand the preview workflow mention them only in prose.
I also redid the arithmetic in the new test cases and the docs/api.md example under the 8.75% round-half-up rule, and every figure matches:
| Case | Expected | Result |
|---|---|---|
| Small + large | 1150 subtotal → 101 tax → 1251 | matches |
| Explicit medium | 900 → 79 → 979 | matches |
| Docs: 2 large lattes with WELCOME10 | 1050 − 105 → 83 tax → 1028 | matches |
There are no new comments or threads.
I'd still skip a separate human code review, for the same reasons as before. The change is small and additive, and a request without size gets today's medium prices. The per-line pricing is checked field by field in TestQuoteOrderLineSizes.
🍪 full review note · reviewed at fdefa63 · comment /biscuit review to run biscuit again.
✅ Agent review: mergingThe PR adds an optional Tested against preview: https://pr-1.brewbar.presto2.clusters.miren.run
|
Adds an optional
sizeto each item inPOST /api/orders:smallmedium(default)largeAPI changes
size. Leaving it out meansmedium, so existing clients, including the mobile app, get the same prices as before.size.unit_centsis the price after the size adjustment. For medium, which every existing client gets, that's the same number as today.422, the same as an unknown item.docs/api.mddocuments all of this. Its example now uses a large latte, and I checked that the running app returns exactly that response.Page
Each drink gets a Small / Medium / Large picker next to its quantity, and the quote shows the size on each line.
Tests
sizeandunit_cents.