Fix weight card trend endpoint not matching headline value#204
Merged
Conversation
The mock weight series applied micro-noise to every point including the final one, so the chart's endpoint dot landed ~0.1 kg (~0.2 lb) above the headline 'current weight' number instead of on it. Anchor the last point to `latest` exactly so the trend line ends where the headline value sits. https://claude.ai/code/session_011Fu9jF8pZ5ivVRKvT2JqPj
today.tsx fell back to createMockWeightSeries() whenever the real /trends/weight_kg series was empty, not just in mock/demo mode. A real user with no weigh-ins saw a synthetic ~1.4 kg downward weight-loss line that never happened. Restrict the synthetic series to mock/demo accounts and render a 'Not enough weight data yet' empty state for real users on both the desktop and mobile Weight cards. https://claude.ai/code/session_011Fu9jF8pZ5ivVRKvT2JqPj
The weekly recap (Phase 3) and high-priority health alerts (Phase 2) shipped with no user-facing controls — they pushed to every subscribed user with no opt-out, even though the settings card advertised control over health alerts. Add recap_enabled and health_alerts_enabled prefs end to end: - migration 0029 + users model columns (default TRUE so existing users keep the notifications they already receive) - /notifications/preferences read + partial-update for both fields - weekly recap worker filters on recap_enabled - alert engine gates the warning-severity push on health_alerts_enabled (the alert is still persisted so it surfaces in-app) - two toggles in NotificationsCard https://claude.ai/code/session_011Fu9jF8pZ5ivVRKvT2JqPj
…tra DB call The per-user SELECT inside _process_user added a 4th db.execute that broke the mocked alert-engine tests and added a round-trip per user. Fold the flag into the existing 'SELECT id FROM users' in run_alert_engine and pass it down as a defaulted param, so isolated callers (tests, manual triggers) keep push behavior and no extra query runs. https://claude.ai/code/session_011Fu9jF8pZ5ivVRKvT2JqPj
Atmospheric brand language: night-ocean bg with sky+sun radial blooms, grid + vignette, the 04D hill+sun mark (dark variant), Inter SemiBold wordmark, a single Instrument-Serif-italic sky->sun accent phrase, and a quiet keyword eyebrow. Ships as a self-contained outlined SVG source plus the rendered PNG for upload as the repo Social preview image. https://claude.ai/code/session_011Fu9jF8pZ5ivVRKvT2JqPj
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.
Problem
On the Today page, the Weight card's trend line endpoint didn't line up with the headline "current weight" number. The final dot floated slightly above the value shown above it (e.g. headline reads
218.0but the dot sits at ~218.2).Cause
createMockWeightSeriesinfrontend/src/lib/mock-data.tsbuilds the chart fromlatest_kg. At the final point the underlyingtrendalready equalslatest, butmicroNoise(~+0.1 kg, ~+0.2 lbafter conversion) was still added to every point, including the last one. So the endpoint never equaled the headline value.The headline (
latestWeight) and the chart both ultimately derive fromlatest_kg, so they should agree at the endpoint; the noise on the final point was the only thing pulling them apart. (For real/trends/weight_kgdata the headlinelatest_kgand the series' lastlast_valuecome from the same latest weigh-in and already match.)Fix
Anchor the final mock point to
latestexactly — no noise on the last sample — so the trend line ends precisely where the headline number sits.Testing
pnpm type-check— cleanpnpm lint— 0 errors (only pre-existing warnings)pnpm test— 97/97 passhttps://claude.ai/code/session_011Fu9jF8pZ5ivVRKvT2JqPj
Generated by Claude Code