Merge remote-tracking branch 'origin/main' into fix/v1397-tz

This commit is contained in:
Marc-André Bombeck committed 2026-10-01 10:59:51 +02:00
commit ada490c7e9
57 files changed
+1485 -99

No files matched your search

+20
View File
@@ -371,6 +371,26 @@ export function resolveEffectiveBpTargets(
};
}
/**
* The user's own blood-pressure band, or `null` when they have not set one.
*
* `resolveEffectiveBpTargets` answers "which band applies" and falls back to
* the age default; this answers "did the person pick it", which is what a
* surface needs to label the band as their own rather than as the guideline.
* A one-sided override (systolic only) still counts: the other half is the
* age default, exactly as `resolveEffectiveBpTargets` fills it.
*/
export function resolveBpTargetOverride(
profile: UserProfileForRange,
thresholdsJson: unknown,
): BpTargets | null {
const hasOverride =
resolveThresholdOverride(thresholdsJson, "BLOOD_PRESSURE_SYS") != null ||
resolveThresholdOverride(thresholdsJson, "BLOOD_PRESSURE_DIA") != null;
if (!hasOverride) return null;
return resolveEffectiveBpTargets(profile, thresholdsJson);
}
/**
* Convenience: resolve every supported metric at once. Useful for /targets
* and the insight generator.