production

This commit is contained in:
2026-08-28 11:13:15 +05:30
parent d7348e253f
commit 5723d373b2
162 changed files with 17924 additions and 7026 deletions

View File

@@ -65,12 +65,57 @@ StopStatus stopStatusFromRaw(dynamic raw) {
case 'miler_assigned':
case 'pending':
return StopStatus.assigned;
// ── The backend's own word for accepted ──
//
// Confirmed by the backend team: `pickup_scheduled` is what a booking sits
// on once the rider has accepted it. It parsed as [StopStatus.unknown] —
// so the rung the pickup UI reads had nothing in it, and any *other* field
// that did parse won by default.
case 'pickup_scheduled':
case 'pickupscheduled':
case 'accepted':
return StopStatus.accepted;
case 'active':
return StopStatus.active;
case 'arrived':
// ── The server's own spellings for the same rung ──
//
// `Arrived_At_Pickup` is what `POST /miler/bookings/:id/reached` now
// persists, and `At_Customer` is the undocumented variant the backend was
// observed sending before it. Neither parsed: both fell to
// [StopStatus.unknown], so the rung the rider had just reported would have
// been dropped the moment the backend started returning it — the same
// symptom the local compatibility store exists to paper over, arriving by
// a different route.
//
// `ApiConfig.legacyStatusFromNew` already folds this into `arrived` for
// rows that come through the booking adapter. This is the other door: a raw
// status read straight off a row, which is what `_fetchQueues` does.
//
// **`At_Customer` is deliberately not here.** `ApiConfig` maps it to
// *arrived at pickup* while the `'at customer'` case further down this
// switch maps it to [StopStatus.deliveryArrived] — two readings of one word
// that cannot both be right. Folding it in on a guess would silently move
// stops between the pickup and delivery halves of the day, which is worse
// than leaving one undocumented spelling unparsed. Worth settling with the
// backend; not worth settling here.
case 'arrived_at_pickup':
case 'arrivedatpickup':
return StopStatus.arrived;
// ── The two words that mean the pickup is done ──
//
// Also confirmed by the backend team, and also unparsed until now:
// `converted_to_consignment` is what the booking becomes when
// `pickup-complete` converts it, and `picked_up` is the same fact said
// plainly. Both are the **pickup milestone**, and both must outrank
// whatever the *delivery* lifecycle has moved on to — see
// [MilkRun.stageOf], which is where that precedence lives.
//
// This is the other half of "Picked showed as Active": with these
// unparsed, `active` was the only word on the row the app could read.
case 'converted_to_consignment':
case 'convertedtoconsignment':
case 'picked_up':
case 'picked':
case 'picked up':
case 'pickuped':