rider status
This commit is contained in:
@@ -33,6 +33,20 @@ export const DELIVERY_STATUS: Record<string, string> = {
|
||||
picked: '#8b5cf6',
|
||||
active: '#14b8a6',
|
||||
skipped: '#f97316',
|
||||
/*
|
||||
* Not from the old console — it never had one, so 30 live rows rendered in
|
||||
* the neutral grey that `statusColor` falls back to. That was survivable
|
||||
* while `rejected` only appeared on the deliveries table; it stopped being
|
||||
* survivable when `orderProgress.ts` started surfacing it on ORDERS, where
|
||||
* grey is the one colour that means "nothing to do here" about the one
|
||||
* status that means "this order needs a rider now".
|
||||
*
|
||||
* Measured against every neighbour in this map before it was chosen: dE 39.5
|
||||
* from `cancelled`, 72.6 from `skipped`, 73.5 from `picked` — all well clear
|
||||
* of the 15 floor. The near misses were #e11d48 (13.9 from cancelled) and
|
||||
* #be123c (20.4), either of which would read as a slightly-off red.
|
||||
*/
|
||||
rejected: '#db2777',
|
||||
delivered: '#10b981',
|
||||
cancelled: '#ef4444',
|
||||
};
|
||||
@@ -171,6 +185,49 @@ export function matchesStatus(key: StatusKey, status: string | undefined): boole
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finished, stopped, or still moving — asked once, in the vocabulary.
|
||||
*
|
||||
* Three screens needed this and three screens wrote their own version. The
|
||||
* drawer's read it from a `SETTLED` array that listed two words; the dispatch
|
||||
* board's was an inline `!== 'delivered' && !== 'cancelled' && !== 'skipped'`.
|
||||
* They disagreed about `rejected`, which is how a job the rider had DECLINED
|
||||
* came to be the one the board called "in progress".
|
||||
*
|
||||
* Routing through `matchesStatus` fixes a second fault the inline comparisons
|
||||
* shared: they were exact matches on free text. Fiesta's casing is inconsistent
|
||||
* between writers, so `Delivered` was silently outstanding forever.
|
||||
*/
|
||||
|
||||
/** Nothing follows these. The job is over, however it ended. */
|
||||
export function isSettled(status: string | undefined): boolean {
|
||||
return matchesStatus('delivered', status) || matchesStatus('cancelled', status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stopped, but not finished — and the difference matters to the operator.
|
||||
*
|
||||
* `rejected` is the rider declining the job; `skipped` is a door nobody
|
||||
* answered. Neither is going to progress on its own, so both need a person,
|
||||
* but the person does something DIFFERENT about each — which is why this is
|
||||
* its own state and not folded into settled.
|
||||
*/
|
||||
export function isStalled(status: string | undefined): boolean {
|
||||
return matchesStatus('rejected', status) || matchesStatus('skipped', status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Work actually under way: somebody is carrying it and it is still moving.
|
||||
*
|
||||
* The complement of the two above, deliberately — a status nobody has taught
|
||||
* this module about counts as live, so a new word on the ladder shows up as
|
||||
* outstanding work rather than vanishing from a board quietly.
|
||||
*/
|
||||
export function isLive(status: string | undefined): boolean {
|
||||
return !isSettled(status) && !isStalled(status);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The money on an order row, in the order the old console reads it.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user