Validate and fix online scheduler close-rate date attribution
Objective
- Validate, lock, and implement the date-attribution rules for online scheduler close rate so the Online / Self-Booked row on the Client Care Dashboard matches how stakeholders expect cohort reporting to work.
- Resolve mismatches where the displayed close rate, # Created, and related counts do not reconcile with exports or sanity checks — especially for abandoned online scheduler quotes and timezone-scoped date ranges.
- Track this separately from prior dashboard timezone and date-type work (ATT-1701, ATT-1809) so remaining online close-rate logic questions are resolved explicitly rather than folded into unrelated fixes.
Background
- The Client Care Dashboard scheduler table (
GET /cc-dashboard/scheduler-metrics) includes an aggregate Online / Self-Booked row (onlineSchedulerinccDashboard.ts), rendered inEmployeeTable.tsxas "Online / Self-Booked" with Close Rate, # Created, and # Confirmed. - Close rate formula (online row mirrors CSR schedulers):
confirmed / (created inspections + open online quotes), wherecreated= non-cancelled online inspections (scheduledBy: null) in the selected date range, and open quotes = online quotes with no linked inspection that count toward the denominator. - Current online open-quote query (as of today) dates each status on an outcome timestamp, not uniformly on
createdAt: pending→createdAtrejected→rejectedAtabandoned→abandonedAt- Inline code comments note this outcome-based filter was added so rejected/abandoned quotes abandoned or rejected within the range are counted — addressing a prior gap vs the Tools dashboard Booking Channel Split widget (
dashboard.ts+computeInternalVsOnline.ts), which usesrejectedAtfor rejected quotes but does not include abandoned quotes in close-rate math. - By contrast, the main CC
GET /metricsclose-rate quote portion usescreatedAtonly for pending + rejected open quotes (no abandoned status in that query). - Inspection date basis on the CC dashboard is controlled by the Date Type filter (ATT-1809 Done):
dateType=booked(default) usesscheduledTs(fallbackdatetime);dateType=inspectionuses appointmentdatetime. Quotes in CC metrics comments say attribution stays oncreatedAtin both modes — but the online-scheduler open-quote branch currently overrides that for rejected/abandoned. - On the June 16 implementation call, the team raised that online scheduler close rate should use a created-date reporting window, and abandoned orders should likely count from their original
createdAt, notabandonedAt, when measuring close rate. - Timezone: CC routes already resolve range boundaries per company via
buildCompanyTzRanges/TZDayjs(same pattern as main dashboard after ATT-1701). Residual mismatches may still come from which date field is filtered, not only boundary math. - Online scheduler drafts auto-abandon after inactivity (
draftAbandonmentWorker.tssetsstatus: 'abandoned'+abandonedAt). CSRs can resume abandoned quotes topending;abandonedAtmay remain set (ATT-1716 Backlog covers durable "started as abandoned" origin reporting — adjacent but separate). - No attachments, linked documents, or inline media on this ticket.
Product Decisions
Locked
(None yet — June 16 call surfaced direction; validation required before locking.)
Open
- Created-date cohort scope — Does "reporting window based on created date" apply to all online open-quote statuses in the denominator (
pending,rejected,abandoned), or abandoned only while rejected keepsrejectedAt? - Abandoned attribution — Confirm abandoned quotes with no linked inspection enter the denominator when
createdAtfalls in range (even ifabandonedAtis later), including quotes later revived topending/acceptedthat still carryabandonedAt. - Inspection half of online row — Keep Date Type filter semantics (
bookedvsinspection) for confirmed/created inspections, or force a single date basis for the entire online close-rate row? - Surface alignment — Fix CC Dashboard online row only, or also align Tools dashboard Booking Channel Split (
InternalVsOnlineSplit.tsx/dashboard.ts) and/orGET /cc-dashboard/metricstop-level close rate? - Quote statuses in denominator — Include
on_holdonline quotes? Excludedraftonly (current behavior)? Any role forarchived? - Numerator definition — Confirmed = online inspections only (
scheduledBy: null, status confirmed), or also accepted online quotes without a booked inspection? - Validation / done criteria — What is the sign-off artifact (written formula doc, automated tests, manual reconciliation against a named export/report for a specific brand + date range)?
- Relationship to ATT-1716 — Is changing date attribution sufficient for v1, or does close rate also require a persisted "started as abandoned" origin flag before numbers are trusted?
Scope
Backend (attik-backend)
- Primary touchpoint:
src/routes/ccDashboard.ts—GET /scheduler-metricsonline open-quote query (~lines 1073–1091) andonlineOpenQuoteCountaggregation (Step 5b);computeRates()close-rate math foronlineScheduler. - Related reference implementations:
GET /metricsopen-quote filter (usescreatedAtfor pending/rejected);src/routes/dashboard.tsrejected-quote aggregation (rejectedAtrange) andsrc/util/functions/dashboard/computeInternalVsOnline.tsfor Booking Channel Split close percentages. - Quote model fields:
quoteSchema.ts—createdType: 'online',status,createdAt,abandonedAt,rejectedAt,_finalInspectionId. - Timezone helpers:
src/util/functions/dashboard/companyTzRanges.ts—tzScopedDateFieldOrused for quote date filters. - Out of scope unless Open #4 expands: Broad CC dashboard refactors unrelated to online close-rate date attribution.
Frontend (attik-frontend)
- Client Care Dashboard:
src/app/admin/client-care-dashboard/_components/EmployeeTable.tsxdisplaysonlineSchedulermetrics; likely no UI change unless product adds explanatory copy/tooltips for date basis after logic is locked. - Tools dashboard:
src/components/dashboard/InternalVsOnlineSplit/InternalVsOnlineSplit.tsx— only in scope if product decides to align Booking Channel Split (Open #4).
Out of scope (unless product expands Open decisions)
- ATT-1716 durable abandoned-origin dimension (separate backlog issue).
- PostHog scheduler funnel analytics (ATT-1944).
- CSR scheduler row open-quote logic (already
createdAt-based; excludes abandoned today).
References
- ATT-1809 — CC Dashboard Date Type filter (Done)
- ATT-1701 — Dashboard timezone fix (Done)
- ATT-1270 — Scheduler close rate / created column alignment (Done)
- ATT-1716 — Started-as-abandoned origin reporting (Backlog, adjacent)
- ATT-1095 — CC close-rate metrics spec (Done)
- Backend:
attik-backend/src/routes/ccDashboard.ts,attik-backend/src/util/functions/dashboard/computeInternalVsOnline.ts - Frontend:
attik-frontend/src/app/admin/client-care-dashboard/_components/EmployeeTable.tsx
Status: Completed
Log in to comment and vote
No comments yet
Be the first to share your thoughts.