Skip to content

fix(dashboard): honest numbers — remove demo margin fake, Season = all-time#602

Merged
barach6662001-bit merged 1 commit intomainfrom
fix/dashboard-honest-numbers
Apr 23, 2026
Merged

fix(dashboard): honest numbers — remove demo margin fake, Season = all-time#602
barach6662001-bit merged 1 commit intomainfrom
fix/dashboard-honest-numbers

Conversation

@barach6662001-bit
Copy link
Copy Markdown
Owner

Problem

User noticed dashboard numbers didn't match the Finance pages:

Dashboard (Сезон) Finance page
Витрати 1.77 млн ₴ ~92 млн ₴
Дохід 9.93 млн ₴ 27.87 млн ₴
Маржа 82.2% ✨ realistic

Two causes:

  1. Demo:EnsurePositiveMargin hack scaled up revenue to a fake +15% margin.
  2. "Сезон" filter used hardcoded Mar 1 → now, which excluded most of the historical data that the /economics and /sales pages show (unfiltered).

Fix

  • Removed Demo:EnsurePositiveMargin entirely from GetDashboardHandler. No more post-query scaling, no flag, no fake numbers. The dashboard reflects exactly what's in CostRecords / Sales.
  • "Сезон" now = all-time. periodToRange('season') returns undefined, so useDashboardQuery omits from/to and the backend returns its legacy all-time totals. This matches the totals shown on /economics (Витрати) and /sales (Продажі).
  • День / Тиждень / Місяць unchanged — they still pass a proper UTC range.

Verify

  • dotnet build
  • cd frontend && npx tsc --noEmit
  • Manual: click "Сезон" → dashboard KPI values equal Finance pages. Click Day/Week/Month → values change to period-scoped figures.

Notes

If true "agricultural season" semantics is needed later, it should be driven by tenant config (spring/autumn start dates), not a hardcoded March 1.

…son = all-time

- Remove Demo:EnsurePositiveMargin display hack from GetDashboardHandler.
  The dashboard now shows the same numbers that are stored in CostRecords
  and Sales, period. No post-query scaling, no configuration flag.
- 'Season' button now fetches the unfiltered, all-time totals so the KPI
  cards match the Finance pages (Продажі, Витрати) exactly. Day / Week /
  Month continue to pass a proper UTC range to the backend.
- periodToRange returns undefined for 'season' so useDashboardQuery
  bypasses from/to query params entirely.

Before: 'Сезон' aggregated only Mar 1 → now, which diverged from the
per-category totals on /economics (92M costs vs dashboard 1.77M), giving
the impression that numbers were invented.
@barach6662001-bit barach6662001-bit merged commit b868bc1 into main Apr 23, 2026
3 checks passed
@barach6662001-bit barach6662001-bit deleted the fix/dashboard-honest-numbers branch April 23, 2026 08:04
barach6662001-bit added a commit that referenced this pull request Apr 24, 2026
#617)

Captures completed work across PR #602-611, remaining scope across PR #612-617,
locked architectural decisions, technical debt, and agent protocol.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant