fix(collection-map): clear assigned_at on unassign so item returns to pool
This commit is contained in:
parent
728bab1671
commit
5ce3ef1000
1 changed files with 9 additions and 0 deletions
|
|
@ -97,6 +97,15 @@ export async function PATCH(
|
|||
patch.notes = readyNotes;
|
||||
}
|
||||
}
|
||||
// Returning an item to the pool (no driver being assigned) also
|
||||
// clears the date the operator originally assigned. Without this,
|
||||
// the item keeps its old `assigned_at` and the collection map's
|
||||
// date filter (which matches by string compare on `assigned_at`)
|
||||
// may still surface it under the wrong day, or hide it entirely
|
||||
// on the un-dated fallback.
|
||||
if (!isAssigning) {
|
||||
patch.assigned_at = "";
|
||||
}
|
||||
|
||||
const pb = await getAdminPocketBase();
|
||||
const current = await pb.collection(getOrderItemsCollectionName()).getOne(id).catch(() => null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue