mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 22:50:51 +00:00
fix(illness,sleep): document the sleep average DTO and gate the recovery driver
Add averagePerNight to the SleepRhythmResource OpenAPI schema so the new average-per-night card's field is part of the iOS-consumed contract (the endpoint already returned it; the Zod source had not been updated, so the in-sync check could not catch the omission). Tag each vital return with whether it deviated in the illness-adverse direction and tally only adverse returns when naming the recovery driver, so a neutral move (e.g. weight drift) can no longer be surfaced as the vital someone recovered ahead of.
This commit is contained in:
1 parent
b9f396c72a
commit
e2ce064254
5 files changed
+116
-6
No files matched your search
@@ -138,13 +138,15 @@ export const GET = apiHandler(async (request: NextRequest) => {
|
||||
derived.status === "ok"
|
||||
? derived.value.adverseCoverageDays
|
||||
: 0,
|
||||
// The vitals that produced a real physiological return —
|
||||
// tallied across the qualifying episodes to name the dominant
|
||||
// driving vital in the summary copy.
|
||||
// The vitals that produced a real physiological return in the
|
||||
// illness-ADVERSE direction — tallied across the qualifying
|
||||
// episodes to name the dominant driving vital in the summary
|
||||
// copy. A neutral move (e.g. weight drift with no adverse
|
||||
// signal) shows a return but must never be named the driver.
|
||||
gapReturnTypes:
|
||||
derived.status === "ok"
|
||||
? derived.value.returns
|
||||
.filter((r) => r.gapDays !== null)
|
||||
.filter((r) => r.gapDays !== null && r.adverse)
|
||||
.map((r) => String(r.type))
|
||||
: [],
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user