mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 14:16:12 +00:00
feat(weight): judge the weight trend against the stored target
The weight tile's arrow, 7-day delta and comparison caption were wired as "up is bad", so a person below their own target who was gaining saw every step toward it coloured as a setback. Movement is now judged against the target they entered: below the band a gain is progress, above it a loss is, and inside it holding steady is, with a move either way shown neutral rather than orange. Without a stored target the tile reads exactly as before; the height-derived band is not treated as a target because nobody chose it. The direction is resolved once on the server and published on the dashboard snapshot as tiles.weightTrend, so the web tile and the native client colour the same reading the same way. The personal-record direction reads the same placement helper. The feature payload behind the briefing, the overview analysis and the Coach now carries the target band and which way is progress, so a narrative no longer calls a gain a regression when gaining is the goal. The insights vitals grid drops weight from its fixed "up is bad" set. Refs #1006
This commit is contained in:
1 parent
0c3195fd41
commit
1273a76a63
14 files changed
+577
-24
No files matched your search
@@ -1201,6 +1201,24 @@ export const dashboardSnapshotResponse = z
|
||||
.describe(
|
||||
"Non-null when two writer buckets reported clearly different asleep totals for the latest night's main session (> 45 min apart and > 20% of the larger total). Observational only — the served summary stays the winning writer's totals; clients may show a discreet 'sources disagree' hint next to the sleep tile's headline. Null when the writers agree or the sleep module is off; optional for older cached snapshots.",
|
||||
),
|
||||
weightTrend: z
|
||||
.object({
|
||||
direction: z
|
||||
.enum(["up-good", "up-bad", "hold"])
|
||||
.describe(
|
||||
"How the weight tile colours a change. `up-good`: a rise is progress (below the target band). `up-bad`: a fall is progress (above the band, and the reading when no target is stored). `hold`: the weight is inside the band, so a flat change is progress and a move either way is neutral, never a setback.",
|
||||
),
|
||||
targetPosition: z
|
||||
.enum(["below", "inside", "above"])
|
||||
.nullable()
|
||||
.describe(
|
||||
"Where the 7-day average (else the latest reading) sits against the person's own stored weight target. Null when no target is stored or there is no reading.",
|
||||
),
|
||||
})
|
||||
.optional()
|
||||
.describe(
|
||||
"Which way a weight change counts as progress, judged against the person's own stored target rather than assuming a fall is good. Render the arrow, 7-day delta and comparison caption from `direction`; do not recompute it. Optional for older cached snapshots; when absent, treat it as `up-bad`.",
|
||||
),
|
||||
}),
|
||||
extras: z
|
||||
.object({
|
||||
|
||||
Reference in new issue
Block a user