updates on the calculation on the dropdown fix
This commit is contained in:
@@ -722,14 +722,22 @@ const Deliveries = () => {
|
||||
// (`Dispatch.js:1198–1206`) — totals here should match the per-batch numbers
|
||||
// visible on the dispatch page for the same date.
|
||||
const batchTotals = useMemo(() => {
|
||||
const totals = { all: countSourceRows.length };
|
||||
// `all` is the SUM of the three batch buckets — not the raw row count.
|
||||
// Rows that fall in a gap (8–9 AM, 12:30–4 PM, after 7 PM) or have no
|
||||
// `assigntime` belong to no batch, so they're excluded here too. This keeps
|
||||
// the "All Batches" badge equal to Morning + Afternoon + Evening
|
||||
// (e.g. 36 + 89 + 53 = 178) instead of over-reporting the un-bucketed total.
|
||||
const totals = { all: 0 };
|
||||
BATCH_OPTIONS.forEach((b) => {
|
||||
if (b.id === 'all') return;
|
||||
totals[b.id] = 0;
|
||||
});
|
||||
countSourceRows.forEach((r) => {
|
||||
const id = getRowBatchId(r);
|
||||
if (id) totals[id] = (totals[id] || 0) + 1;
|
||||
if (id) {
|
||||
totals[id] = (totals[id] || 0) + 1;
|
||||
totals.all += 1;
|
||||
}
|
||||
});
|
||||
return totals;
|
||||
}, [countSourceRows]);
|
||||
|
||||
Reference in New Issue
Block a user