miler map

This commit is contained in:
2026-09-09 12:55:23 +05:30
parent 074cc0eccf
commit 127fa062ed
143 changed files with 4315 additions and 2291 deletions

View File

@@ -92,15 +92,28 @@ StopStatus stopStatusFromRaw(dynamic raw) {
// 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.
// ── `At_Customer` — settled, and it means arrived at the PICKUP ──
//
// This word was read two ways: `ApiConfig` folded it to *arrived at
// pickup*, and the delivery case further down this switch folded it to
// [StopStatus.deliveryArrived]. Both could not be right, and a wrong guess
// moves a stop between the two halves of the rider's day — so it was left
// unparsed rather than settled on a hunch.
//
// The backend team answered it: `At_Customer` is a
// `milerprofiles.availabilitystatus` value, not a booking or consignment
// state, so it says where the **rider** is and not where the parcel is. The
// only thing that writes it is `POST /miler/bookings/:id/reached` — the
// pickup-arrival action. Nothing sets it on a delivery leg; a rider heading
// to a receiver goes `On_Delivery`. The name is misleading and predates the
// current lifecycle.
//
// So it belongs here, with the other spellings of the pickup arrival.
// `ApiConfig` was right and this file was wrong.
case 'arrived_at_pickup':
case 'arrivedatpickup':
case 'at customer':
case 'at_customer':
return StopStatus.arrived;
// ── The two words that mean the pickup is done ──
//
@@ -131,8 +144,6 @@ StopStatus stopStatusFromRaw(dynamic raw) {
return StopStatus.outForDelivery;
case 'deliveryarrived':
case 'delivery_arrived':
case 'at customer':
case 'at_customer':
return StopStatus.deliveryArrived;
case 'delivered':
return StopStatus.delivered;