Objective
- Align the scheduler table “Selected Add Ons” rate with the same add-on categories the user selects for the add-on panel (global service categories), so the number reflects selected add-ons—not an overall “any add-on” rate.
- Review and correct close rate (and related) calculations on the Client Care dashboard so reported rates match the intended definitions and stay consistent across surfaces.
- ALSO, can we make the dropdown list on the add on service categories only show services that are upsellable : true
Background
- On Attik Admin → Client Care Dashboard, users can filter global add-on categories; the main metrics path returns per-category (and combined) add-on rates that depend on those selections.
- Product feedback: for schedulers, the column labeled like selected add-ons is effectively showing a broader add-on signal (overall / any-add-on style), not the rate for the currently selected category set.
- There is also an open need to tighten close-rate math so leadership can trust the dashboard without manual reconciliation.
Scope
Backend — attik-backend
GET /cc-dashboard/metricsinsrc/routes/ccDashboard.tsalready takesglobalCategoryIds, resolves categories and descendant categories againstGlobalServiceCategoryandServiceCategoryAssignment, then usesCharge.distincton_inspectionIdscoped to core inspection id lists from thecc_inspection_baseview (CC_INSPECTION_BASE_VIEWfromsrc/util/constants/ccDashboard.js). That path is the reference for “selected add-on” semantics.GET /cc-dashboard/scheduler-metricsin the same file does not readglobalCategoryIds. The aggregation uses view fields such ashasAddonforaddonNum/addonDenom, andcomputeRatesexposes that asselectedAddOnRate—so the API name and UI label imply selected categories, while the implementation is category-agnostic unless changed.- Open-quote handling for close rate on
/metricsusesQuoteplus primaryChargerows andserviceFlagMapfrom assignments;/scheduler-metricshas a parallel path (includingcreatedType: 'csr'constraints for open quotes). Any close-rate fixes should preserve parity between KPI / metrics and scheduler breakdowns unless product explicitly diverges. - The Mongo view is built by
scripts/createCcDashboardViews.ts; if category-scoped add-on presence per row is needed at aggregation time, the view or pipeline may need extending—decision needed on whether to push category logic into the view, reuse charge lookups like/metrics, or another approach.
Frontend — attik-frontend
src/app/admin/client-care-dashboard/CCDashboardClient.tsxloads add-on rates viacc-dashboard/metricswithglobalCategoryIdsinfetchAddonRates, but loads scheduler data viafetchSchedulerMetricswith onlycompanyIds,startDate, andendDate—no selected category ids—so the UI cannot today drive scheduler add-on rates from the same selection.src/app/admin/client-care-dashboard/_components/EmployeeTable.tsxlabels the column around selected add-ons and blendsselectedAddOnRateacross rows usingordersCreatedweights incomputeSubsetAverage; once the API matches selected categories, confirm the aggregate row still matches the intended definition.- Types for scheduler rows live in
src/app/admin/client-care-dashboard/_types.ts(selectedAddOnRateonSchedulerRow).
References
- Slack context (issue attachment): thread that describes the scheduler “selected add-on” vs overall add-on behavior.
- View pipeline:
scripts/createCcDashboardViews.tsandCC_INSPECTION_BASE_VIEWusage insrc/routes/ccDashboard.ts.