{{ message }}
Repository navigation
feat(frontend/dashboard): Potential Monthly Savings card mirrors Recommendations-page range (closes #293) - #295
Merged
cristim merged 1 commit intoMay 5, 2026
Conversation
…mmendations-page range (closes #293) Dashboard's "Potential Monthly Savings" card previously read summary.potential_monthly_savings — a flat sum across every variant of every cell that overstates achievable savings by ~6x (the same bug class #272 closed on the Recommendations page). Frontend-only fix: loadDashboard now fetches /api/recommendations concurrently alongside /api/dashboard/summary and /api/upcoming via Promise.allSettled (failure of any individual fetch is isolated — the dashboard still renders with graceful fallbacks). The per-cell range is computed client-side via the existing groupRecsByCell / pageLevelRange / formatSavingsRange helpers already used by the Recommendations page. formatSavingsRange is newly exported from recommendations.ts to enable reuse. If getRecommendations fails, the savings card falls back to $0 and the other three cards (Active Commitments, Current Coverage, YTD Savings) render normally from the summary response. The backend change to /dashboard/summary is deferred; a future PR can move the range computation server-side if needed.
Contributor
Member
Author
|
@coderabbitai review |
Contributor
Closed
6 tasks
8 tasks done
7 tasks done
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.

Summary
summary.potential_monthly_savings— a flat sum across every variant of every cell that overstates achievable savings by ~6x (same bug class as ux(frontend/recs): Potential Monthly Savings card sums all variants — should mirror Recommended range #272 on the Recommendations page)loadDashboardnow fetches/api/recommendationsconcurrently alongside the existing summary + upcoming calls, computes the per-cell range client-side usinggroupRecsByCell/pageLevelRange/formatSavingsRange(same helpers the Recommendations page uses), and renderssavingsMin – savingsMaxon the cardformatSavingsRangeis exported fromrecommendations.tsto enable reuseBehaviour change
Before:
$Xwhere X is the sum of every variant of every cell (overcounted)After:
$min – $max(or$Xif min == max) — matches the Recommendations-page cardImplementation notes
/api/dashboard/summaryis left unchanged. A future backend PR can move range computation server-sidePromise.allSettled: if/api/recommendationsfails, the savings card falls back to$0; Active Commitments, Current Coverage, YTD Savings still render from the summary responseTest plan
npm run typecheck— cleannpm test -- --testPathPattern=dashboard— 21/21 pass (+3 new tests)Potential Monthly Savings card renders per-cell range (#293)— asserts range shown, flat sum NOT shownfailure-isolation: rec fetch failure leaves other cards rendered (#293)— asserts other cards intact, savings falls back to $0legacy summary.potential_monthly_savings is no longer read for the savings card (#293)— asserts $700 summary value not shown when recs give $300-$400Summary by CodeRabbit
New Features
Tests