Skip to content

Fix weight card trend endpoint not matching headline value#204

Merged
d3mocide merged 5 commits into
mainfrom
claude/laughing-dirac-u8yy1h
Jun 14, 2026
Merged

Fix weight card trend endpoint not matching headline value#204
d3mocide merged 5 commits into
mainfrom
claude/laughing-dirac-u8yy1h

Conversation

@d3mocide

Copy link
Copy Markdown
Owner

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.0 but the dot sits at ~218.2).

Cause

createMockWeightSeries in frontend/src/lib/mock-data.ts builds the chart from latest_kg. At the final point the underlying trend already equals latest, but microNoise (~+0.1 kg, ~+0.2 lb after 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 from latest_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_kg data the headline latest_kg and the series' last last_value come from the same latest weigh-in and already match.)

Fix

Anchor the final mock point to latest exactly — no noise on the last sample — so the trend line ends precisely where the headline number sits.

Testing

  • pnpm type-check — clean
  • pnpm lint — 0 errors (only pre-existing warnings)
  • pnpm test — 97/97 pass

https://claude.ai/code/session_011Fu9jF8pZ5ivVRKvT2JqPj


Generated by Claude Code

claude added 5 commits June 14, 2026 04:20
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
@d3mocide d3mocide marked this pull request as ready for review June 14, 2026 05:00
@d3mocide d3mocide merged commit 92d66fc into main Jun 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants