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:
Marc-André Bombeck committed 2026-09-24 09:22:50 +02:00
1 parent 0c3195fd41
commit 1273a76a63
14 files changed
+577 -24

No files matched your search

+29
View File
@@ -50735,6 +50735,35 @@ components:
- sources
additionalProperties: false
- type: "null"
weightTrend:
description: 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`.
type: object
properties:
direction:
type: string
enum:
- up-good
- up-bad
- hold
description: "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:
anyOf:
- type: string
enum:
- below
- inside
- above
- type: "null"
description: 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.
required:
- direction
- targetPosition
additionalProperties: false
required:
- summaries
- lastSeenByType