CMM-1973: Views card period selection and chart improvements - #22726
Conversation
Save the user's line/bar chart preference via SavedStateHandle (process death) and SharedPreferences (app restart), mirroring the existing period persistence pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove previous period series from bar chart and increase bar thickness from 8dp to 16dp for better readability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tapping a bar changes the period selector to the tapped period: daily bars drill into that single day, monthly bars into the full month. Hourly bars (smallest granularity) are ignored. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Generated by 🚫 Danger |
|
|
|
|
Single-day custom periods now use hourly granularity (24 data points) and month-long periods use daily granularity. Threshold bumped from 30 to 31 so 31-day months don't fall into the monthly bucket. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Overlay the previous period data as a grey line (no area fill) on the bar chart so users can compare current vs previous at a glance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace cubic curves with sharp connectors in both line and bar chart modes. Add dashed stroke to the previous period overlay line in bar mode to match the line mode style. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use the current period type to determine granularity instead of guessing from the raw period format. The API returns daily-format dates (YYYY-MM-DD) even for monthly data, so monthly taps now correctly create a full-month Custom period (first to last day). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…down Show a loading spinner overlay (with dimmed content) when tapping a bar instead of replacing the card with a full shimmer skeleton. Also fix drill-down for custom periods with monthly granularity using the same daysBetween > 31 threshold as the repository. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reuse existing isCustomPeriodMonthly() in drillDownPeriod() instead of duplicating the MAX_DAYS_IN_MONTH threshold. Simplify the conditional alpha modifier to idiomatic Compose style. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move storage key conversion into ChartType enum (storageKey / fromStorageKey), removing duplicated string constants and when blocks. Add guard to ignore bar taps while a drill-down is already loading. Add 10 unit tests covering chart type persistence, drill-down edge cases, and the loading guard. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Claude finished @adalpari's task in 2m 31s —— View job Code Review: CMM-1973 Views Card Period Selection & Chart Improvements
Overall this is a solid PR with clean MVVM patterns, good test coverage, and well-structured UI state management. A few issues worth addressing before merging: Bugs1. Double-load race condition in
|
This is expected because the label will always be localised. |
…in test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #22726 +/- ##
==========================================
+ Coverage 37.36% 37.38% +0.02%
==========================================
Files 2316 2316
Lines 123376 123507 +131
Branches 16734 16758 +24
==========================================
+ Hits 46096 46177 +81
- Misses 73574 73623 +49
- Partials 3706 3707 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The Vico chart library crashes when CartesianValueFormatter returns an empty string. Return a space for out-of-range x-axis indices. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix import ordering (CircularProgressIndicator in material3 group) - Replace space workaround in x-axis formatter with merged labels from both periods and toString() fallback - Wrap date parsing in drillDownPeriod with try-catch for safety - Extract drillDownMonth helper for clarity - Remove stale test comment and identical if/else branches - Remove extra blank line before @hiltviewmodel Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Store the tapped index in onShown and trigger the period change in onHidden, so the user sees the marker tooltip before the chart reloads. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@adalpari This looks good, but one problem was flagged: 1.
|
NumberFormatException from drillDownMonth() was not caught by the DateTimeParseException-only catch block. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
CI detekt flags TooGenericExceptionCaught. Catch both DateTimeParseException and NumberFormatException explicitly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
I do mean that, yes. I'm not sure how to make it more prominent. I'd suggest adding a large label at the top like our web app, but that would take up extra space where space is at a premium. |








Description
Adds chart improvements and drill-down interaction to the Views stats card:
Testing instructions
Persist chart type:
Drill down on bar tap:
Verify the period selector changes to the full month (first to last day)
Verify the chart shows daily data points for that month
Smoke tests bar taps
Screen_recording_20260324_140240.mp4