fix(doctor-report): aggregate sleep per night, not per stage

The doctor-report PDF computed SLEEP_DURATION min/avg/max over the raw
per-stage rows (a 40-minute DEEP block, a 12-minute AWAKE block), so its
sleep figure was per-stage-row minutes while every other surface — the
dashboard slim slice, /insights/sleep, /api/sleep/night, the iOS feed —
shows the reconstructed per-night asleep total. The sleep-stamping work
rewrites exactly those raw rows, so the report could drift independently.
Route the report sleep value through the night reconstruction engine, the
same way the recovery score routes through the canonical recovery resolver
— one number, every surface. The user's source priority feeds the
reconstruction so the multi-source de-dup matches the dashboard.
This commit is contained in:
Marc-André Bombeck committed 2026-06-15 01:28:04 +02:00
1 parent 33e7f20736
commit 790fecddb8
2 files changed
+38 -1

No files matched your search

Binary file not shown.