fix(illness): keep chronic conditions out of rest mode

A chronic ongoing condition has no end date, so counting it as rest mode
kept the account in it for good: Day N counted from an onset years back,
cadence nudges never resumed and every streak gap since the onset was
bridged. Only active episodes that are not CHRONIC_ONGOING (acute,
recurring, flare) now trigger rest mode, and Day N counts from the
earliest of those. The achievements streak freeze applies the same
filter to its own episode query.

Chronic conditions stay context: a coincident vital deviation is still
framed as explained by any active episode, and the Coach block and the
briefing still name them, with restMode false.

Refs #1216
This commit is contained in:
Marc-André Bombeck committed 2026-10-14 18:57:01 +02:00
1 parent bc7f3bf209
commit 9aa60fb2ff
15 files changed
+513 -64

No files matched your search

+1 -1
View File
@@ -210,7 +210,7 @@ export const dailyDigestResponse = z
})
.nullable()
.describe(
"Rest Mode: present while an illness episode is active and the illness module is on, else null. Additive since v1.40.",
"Rest Mode: present while an illness episode that is not chronic ongoing (acute, recurring or flare) is active and the illness module is on, else null. A chronic ongoing condition alone never sets it; `day` counts from the earliest onset among the episodes that do. Additive since v1.40.",
),
line: z
.string()
+1 -1
View File
@@ -2204,7 +2204,7 @@ export const healthScoreReport = z
.nullable()
.optional()
.describe(
"Set on every response this route produces (null when no illness episode is active). Rest Mode FRAMES the score and never changes it: the number above is left exactly as computed and this attaches the value-free context. Resolved as of the scored window, not a fresh now.",
"Set on every response this route produces (null when no illness episode is active, or only chronic ongoing ones are: a condition the person lives with frames a dip but never puts the account into Rest Mode). Rest Mode FRAMES the score and never changes it: the number above is left exactly as computed and this attaches the value-free context. Resolved as of the scored window, not a fresh now.",
),
})
.meta({