mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
Surface sleep-debt and chronotype on the sleep page
Compute cumulative sleep debt and the MCTQ chronotype server-side off the canonical night reconstruction the Sleep Score reads, and render them on the sleep page: a sleep-debt headline with a calm partial state under the night threshold, and a chronotype card whose social-jetlag detail and corrected mid-sleep sit behind an advanced disclosure. Both hold a learning state on thin data and never assert a total or a band. Serve the same values to the dashboard summary and a new GET /api/sleep/rhythm read so the native client renders identical figures. Free vs work nights default to weekend in the user's timezone until day-type tracking exists.
This commit is contained in:
1 parent
4884f019b7
commit
d1ba01548f
22 files changed
+1489
-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