Fix ice bag count + default ice check-in to 1 bag
The form sends payment_ice as a descriptive label, e.g. "One Ice
ticket good for one bag per day (3 total bags)". The old parser pulled
the first number ("3") and treated it as 3 tickets, then multiplied by
3 bags/ticket → 9 bags for one ice ticket (18 for two). New
iceBagsFromPayment reads the "(N total bags)" the label states
directly, with worded-count and numeric dollar/count fallbacks for
forward compatibility. 1 ice → 3 bags, 2 → 6. 5 new tests.
Scanner: Ice mode now defaults the check-in count to 1 (a bag at a
time) instead of all remaining bags; staff can bump it up.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
49e45ff94c
commit
049f433930
4 changed files with 64 additions and 9 deletions
|
|
@ -109,8 +109,9 @@ export default function ScannerScreen() {
|
|||
feedbackSuccess();
|
||||
const remaining = mode === "ice" ? res.ticket.ice.remaining : res.ticket.remaining;
|
||||
setTicket(res.ticket);
|
||||
// Ice: default to grabbing all remaining bags at once. Tickets: default 1.
|
||||
setCount(mode === "ice" ? Math.max(1, remaining) : Math.min(1, remaining));
|
||||
// Default to 1 (people usually grab ice a bag at a time); staff can bump
|
||||
// the count up. Clamp to what's left so a 0-remaining ticket stays at 0.
|
||||
setCount(Math.min(1, remaining));
|
||||
setPhase("confirm");
|
||||
} catch (e: any) {
|
||||
if (e?.name === "AuthError") return router.replace("/login");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue