Repository navigation
fix(dashboard): merge per-service savings charts and populate current_savings (closes #908) - #910
Conversation
…_savings (closes #908) Backend: summarizeRecommendationsWithCoverage now sets ServiceSavings.CurrentSavings (previously never written, so the Home chart's current series was always $0). It reuses scaledSavings, the same coverage-scaled amount used for the per-service potential, so current is keyed and scaled identically. Adds a regression test asserting non-zero current_savings where coverage exists. Frontend: collapses the two Home per-service charts into one. The old standalone "Potential Savings by Service" grouped chart (renderSavingsChart) and its #savings-chart container are removed. The surviving range chart now draws each service's current (committed) savings as a separate bar in a programmatically-darkened shade of that service's potential hue (darkenHexColor, ~30% darker per channel, hue preserved). Preserves the top-N "+N more" cap, chip filter re-render, empty/zero states, escaped axis/legend labels, and chart dedup.
|
Warning Review limit reached
More reviews will be available in 14 minutes and 58 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
Closes #908. Merges the two Home per-service savings charts into one range chart with a current-savings underlay, and fixes the backend bug where per-service
current_savingswas never populated.Backend bug fix
summarizeRecommendationsWithCoverage(internal/api/handler_dashboard.go) builtby_servicesetting onlyPotentialSavings;ServiceSavings.CurrentSavingswas always its float64 zero, so the frontend rendered an empty Current series.Fix: also set
svc.CurrentSavings += scaled, wherescaledis the existingscaledSavings(rec, coverageByKey)value (rec.Savings * min(coverage,100)/100). This reuses the same coverage-scaled amount already used for the per-service potential, so current is keyed and scaled identically to potential. A regression test (TestSummarizeRecommendationsWithCoverage_PopulatesCurrentSavings) asserts non-zero, correctly-scaledcurrent_savingsper service; the existing table test now also assertsCurrentSavings.Frontend merge
renderSavingsChart"Potential Savings by Service" chart and its#savings-chart-section/#savings-chartcontainer inindex.html.renderSavingsByService) now also draws each service's current (committed) savings as a separate bar in a DARKER shade of that service's potential hue. The darker shade is derived programmatically (darkenHexColor, ~30% per-channel reduction, hue preserved), not hardcoded per service.loadDashboard), empty/zero states, non-empty axis + legend labels (a11y), chart instance dedup.Tests
go test ./internal/api/...green (1385 passing).by_service, chip-change re-render, empty-state, plusdarkenHexColor/parseHexColorunit tests.html.test.tsasserts the old chart is gone.tsc --noEmitclean.