mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
feat(sleep): surface sleep debt and chronotype
Assemble a sleep-rhythm read on the canonical per-night reconstruction — the same midpoints and asleep totals the sleep score uses — that reports a rolling sleep debt against the age-based need and an MCTQ chronotype with its mid-sleep, social jetlag and band. A shared assembler caps the chronotype window so the dashboard and the dedicated read return identical values, and both withhold a confident reading behind a learning state until enough nights accrue. The sleep page gains a debt headline and a chronotype card with the deeper detail behind an advanced disclosure; the sleep score is left untouched so debt reframes the sufficiency gap without double-counting it.
This commit is contained in:
commit
a970ba8ab0
22 files changed
+1529
-2
No files matched your search
@@ -67,6 +67,8 @@ export const measurementDependentKeys = [
|
||||
["trend-series"] as const,
|
||||
// v1.11.5 — refresh the last-night hypnogram when sleep rows change.
|
||||
["sleep-night"] as const,
|
||||
// v1.17.0 — refresh the sleep-debt + chronotype read when sleep rows change.
|
||||
["sleep-rhythm"] as const,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,6 +45,14 @@ export const measurementKeys = {
|
||||
*/
|
||||
sleepNight: (date?: string) => ["sleep-night", date ?? "latest"] as const,
|
||||
|
||||
/**
|
||||
* v1.17.0 — sleep-rhythm read (`GET /api/sleep/rhythm`): the
|
||||
* server-authoritative sleep-debt + chronotype DTO. Reads the same raw
|
||||
* SLEEP_DURATION rows the night view does, so a sleep write invalidates
|
||||
* it through the shared measurement-dependent set.
|
||||
*/
|
||||
sleepRhythm: () => ["sleep-rhythm"] as const,
|
||||
|
||||
/**
|
||||
* v1.4.40 W-RSC — per-chart daily-aggregate fetch from the dashboard
|
||||
* + insights chart row. Pre-fix the key was bare `["chart-data", …]`
|
||||
|
||||
Reference in new issue
Block a user