fix(stats): period-aware steps/sleep tiles, sleep hover totals, live Today button#44
Merged
Merged
Conversation
…Today button The Stats wearable tiles for Steps and Sleep showed fixed windows that ignored the selected period: steps "7-day avg" and sleep "7-day avg" / "Deep (last)" never changed when switching Week/Month/Year/All-time even though the charts did. - Steps: "Avg / day" and "Best day" now compute over the selected period. - Sleep: "Avg / night" and "Deep" (total deep ÷ total sleep) now compute over the selected period. - Sleep chart hover now uses index mode: hovering a night shows every stage (Deep/Light/REM/Awake) plus a "Total sleep" footer. - Relabel tiles accordingly (7-day avg → Avg / day, Avg / night; Deep (last) → Deep). Also fix the main page "Today" button: goToToday() used window._serverDate, which is rendered server-side at page load, so a phone left open across midnight sent "Today" to yesterday. It now computes the live device date (en-CA YYYY-MM-DD). Regenerated assets/screenshot-stats-steps.png and -sleep.png for the new labels. Frontend-only; no schema change. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
What
Four reported issues, all frontend-only (no schema change):
Avg / dayandBest daynow compute over the selected Week/Month/Year/All-time window (were hardcoded last-7-days / all-time).Avg / nightandDeep(total deep ÷ total sleep) now compute over the selected period (were last-7-days / last-night only).Total sleepfooter.goToToday()usedwindow._serverDate(baked in at page load), so a phone left open across midnight jumped to yesterday. Now uses the live device date.Tile labels relabeled:
7-day avg → Avg / day(steps),7-day avg → Avg / night+Deep (last) → Deep(sleep).Regenerated
screenshot-stats-steps.pngandscreenshot-stats-sleep.png.Note
The treadmill cardio event the issue started from was already auto-logged by the MQTT consumer (
health_recordid 823, 04:39→04:59 EDT, ~19m49s) and shows on Stats → Cardio — no data change needed.🤖 Generated with Claude Code