updates on the astryx desing

This commit is contained in:
2026-08-14 16:09:14 +05:30
parent d3dd687a8d
commit a46212f291
106 changed files with 10244 additions and 24738 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -50,10 +50,19 @@ const BRAND = '#000000';
// match exactly or the chip and the table below it would disagree.
const orderRevenue = (km) => (km <= BASE_KM_LIMIT ? BASE_REVENUE : BASE_REVENUE + (km - BASE_KM_LIMIT) * EXTRA_RATE_KM);
// Buckets on `orderdate` (the booking's createdat) and parses with
// parseDoormileTimestamp — must match ProfitabilitySection.getRowBatch,
// Dispatch.js's BATCH_TIME_FIELD and deliveries.js's BATCH_TIME_KEYS.
//
// It used to read `assigntime`, which api.js maps to the backend's
// last-modified column, so it was re-stamped by any status change and a
// rider's slot count drifted through the day; and it parsed with a bare
// dayjs(), which mis-handles the false trailing Z some Doormile timestamps
// carry. Slot count feeds the FIXED cost, so both bugs moved money.
const getOrderBatch = (o) => {
const t = o.assigntime || o.deliverydate;
const t = o.orderdate;
if (!t || /^\d{4}-\d{2}-\d{2}$/.test(String(t).trim())) return null;
const d = dayjs(t);
const d = parseDoormileTimestamp(t);
if (!d.isValid()) return null;
const hour = d.hour() + d.minute() / 60;
const batch = BATCHES_DEFAULT.find((b) => hour >= b.startHour && hour < b.endHour);
@@ -111,11 +120,7 @@ const Profitability = () => {
if (SKIPPED_STATUSES.has(status)) return;
// parseDoormileTimestamp (not bare dayjs()) avoids the false-trailing-Z
// parse bug (utils/doormileTimestamp.js) — see ProfitabilitySection.js.
const dateStr = o.assigntime
? parseDoormileTimestamp(o.assigntime).format('YYYY-MM-DD')
: o.deliverydate
? parseDoormileTimestamp(o.deliverydate).format('YYYY-MM-DD')
: null;
const dateStr = o.orderdate ? parseDoormileTimestamp(o.orderdate).format('YYYY-MM-DD') : null;
if (dateStr !== selectedDate) return;
const km = parseFloat(o.riderkms || 0);
revenue += orderRevenue(km);

File diff suppressed because it is too large Load Diff