updates on the ai bot and assigned by chatbot

This commit is contained in:
2026-08-20 12:00:12 +05:30
parent 37ca2352e2
commit e1cc874218
17 changed files with 794 additions and 248 deletions

View File

@@ -48,6 +48,12 @@ This is a constant, not state. The operator-facing time-field dropdown and the s
Those two key positions were previously destructured-but-ignored, which meant changing the date refetched and returned an identical row set — every batch count was the same for today, yesterday and last week. If you add a filter to this query, make sure `fetchDeliveries` actually reads it; a query key position that nothing consumes is a silent no-op.
#### ⛔ Don't admit rows on `updatedat` while bucketing on `createdat`
An opt-in "activity" date basis was added so an order booked yesterday and still moving today would appear on today's board, then **reverted**. Admitting a row on one timestamp while bucketing it on another cannot produce an honest batch: an order created yesterday at 6 PM and merely touched today was let onto today's board and then bucketed by its creation hour, so **Evening Batch read 6 at 10:41 in the morning on a day with no orders created at all**.
The filter field and the bucket field have to be the same field. If carried-over work needs to be visible on the board, it needs its own bucket ("Carried over") — not a time-of-day wave it does not belong to. Decide that before reaching for the date filter again.
### ⛔ Never bucket on `assigntime`
It is **not** an assignment time. The Doormile bookings feed has no assignment timestamp, so `api.js` maps `assigntime` to the booking's `updatedat` — its last-modified column. Any status change, parcel scan, payment or pickup-complete re-stamps it.

View File

@@ -1330,18 +1330,7 @@ const Dispatch = ({
hasNextPage: liveHasNextPage,
isFetchingNextPage: liveIsFetchingNextPage
} = useInfiniteQuery({
// The trailing 'activity' is the date basis (api.js reads queryKey[11]).
// Without it this board was scoped to orders CREATED on the selected date,
// so an order booked yesterday and accepted, picked or still in transit
// today never appeared — the one case a live dispatch board most needs to
// show. A row now qualifies if it was created OR last updated in the
// window.
//
// Batch bucketing is unchanged: it still reads `orderdate` (BATCH_TIME_FIELD
// = 'created'), so a carried-over order buckets by the time of day it was
// originally placed. That is deliberate — the wave an order belongs to
// doesn't change because it is late.
queryKey: ['dispatchDeliveries', selectedAppLocationId, liveUserid, 'all', selectedDate, selectedDate, 50, '', 0, 0, 0, 'activity'],
queryKey: ['dispatchDeliveries', selectedAppLocationId, liveUserid, 'all', selectedDate, selectedDate, 50, '', 0, 0, 0],
queryFn: fetchDeliveries,
getNextPageParam: (lastPage) => lastPage.nextPage ?? undefined,
enabled: shouldFetchLive,

View File

@@ -15,7 +15,7 @@ import {
} from 'react-icons/md';
import { Grid } from '@astryxdesign/core/Grid';
import { KpiGrid } from 'components/nearle_components/PageLayout';
import { KpiGrid, TABLE_FRAME } from 'components/nearle_components/PageLayout';
import { HStack } from '@astryxdesign/core/HStack';
import { VStack } from '@astryxdesign/core/VStack';
import { Center } from '@astryxdesign/core/Center';
@@ -375,8 +375,15 @@ function RiderProfitabilityCard({ rider, metrics, isExpanded, isFocused, onToggl
if (!isFocused && onFocus) onFocus(rider);
};
// The resting frame matches every other table in the app. The focused state
// keeps its accent outline — that is a selection affordance, not decoration,
// and the brief was explicit about leaving selection alone.
return (
<Card padding={0} elevation="none" style={isFocused ? { outline: '2px solid var(--color-accent)' } : undefined}>
<Card
padding={0}
elevation="none"
style={{ border: TABLE_FRAME, ...(isFocused ? { outline: '2px solid var(--color-accent)' } : null) }}
>
<Collapsible
isOpen={isExpanded}
onOpenChange={handleOpenChange}