Repository navigation
fix(stats): group Last 10 Days by the local date, not UTC - #632
Conversation
aggregate_days labelled each play with its UTC date while the streak strip and the hour chart use local time, so plays near midnight landed on the wrong day outside UTC. Split out aggregate_days_in over a TimeZone, keep aggregate_days as the Local wrapper, and test it with fixed offsets so the result does not depend on the machine's zone. Fixes LargeModGames#602 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: LargeModGames/spotatui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughDaily listening totals now use local calendar dates instead of UTC dates. Fixed-offset tests verify date shifts and aggregation for records that share a local date. ChangesLocal-Date Listening Aggregation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The local-date grouping change appears ready to merge after normal checks. Architecture SummaryArchitecture risk: 🟡 Medium · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Reliability and maintainability
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Summary
Fixes #602.
aggregate_daysnow delegates toaggregate_days_in(listens, tz), which keys aBTreeMap<NaiveDate, u64>byended_at.with_timezone(tz).date_naive(), the same wayqualified_day_totalsdoes.aggregate_dayskeeps its signature and passes&Local, so neither caller changes.Tests go through
aggregate_days_inwith fixed offsets, so they give the same result on a UTC runner and on any machine:days_use_the_local_date_west_of_utcdays_use_the_local_date_east_of_utcdays_merge_plays_that_share_a_local_dateThe
Month/Yeararms offilter_listens_for_periodare left alone, as the issue says.Testing
cargo fmt --all -- --check: cleancargo clippy --no-default-features --features telemetry,tui -- -D warnings: cleancargo test --no-default-features --features telemetry,tui: 1284 passed, 0 failedcargo test --no-default-features --features telemetry,tui local_date: 3 passed, 1281 filtered outAdditional notes
This is one of five small PRs I opened together (#602, #603, #594, #595, #599). Each changelog entry sits at a different spot in
[Unreleased]so they merge without conflicts in any order.Written with AI coding assistants: the fix was drafted by Codex, then extracted onto its own branch, checked against the issue and re-tested by Claude Code.
🤖 Generated with Claude Code
Summary by CodeRabbit