fix(dashboard): honest numbers — remove demo margin fake, Season = all-time#602
Merged
barach6662001-bit merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
…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.
This was referenced Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
User noticed dashboard numbers didn't match the Finance pages:
Two causes:
Demo:EnsurePositiveMarginhack scaled up revenue to a fake +15% margin./economicsand/salespages show (unfiltered).Fix
Demo:EnsurePositiveMarginentirely fromGetDashboardHandler. No more post-query scaling, no flag, no fake numbers. The dashboard reflects exactly what's inCostRecords/Sales.periodToRange('season')returnsundefined, souseDashboardQueryomitsfrom/toand the backend returns its legacy all-time totals. This matches the totals shown on/economics(Витрати) and/sales(Продажі).Verify
dotnet build✅cd frontend && npx tsc --noEmit✅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.