fix(insights): health-score BP pillar from all-time window + surface ACTIVITY_STEPS in Insights

This commit is contained in:
Marc-André Bombeck committed 2026-06-05 22:47:46 +02:00
1 parent 3c87ee9230
commit 016f866965
15 files changed
+238 -3

No files matched your search

@@ -169,4 +169,26 @@ describe("hasMetricData", () => {
}),
).toBe(false);
});
// Steps are stored as `ACTIVITY_STEPS`; the Insights tab strip + the
// routed sub-page gate on that key. A regression had Steps absent from
// the metric registry entirely, so the pill / sub-page never surfaced
// despite the dashboard tile already reading `summaries.ACTIVITY_STEPS`.
it("returns true for ACTIVITY_STEPS when the summary count is positive", () => {
expect(
hasMetricData("ACTIVITY_STEPS", {
...emptyInputs,
summaries: { ACTIVITY_STEPS: fakeSummary(4200) },
}),
).toBe(true);
});
it("returns false for ACTIVITY_STEPS when the summary count is zero", () => {
expect(
hasMetricData("ACTIVITY_STEPS", {
...emptyInputs,
summaries: { ACTIVITY_STEPS: fakeSummary(0) },
}),
).toBe(false);
});
});
+8
View File
@@ -51,6 +51,14 @@ export type InsightMetric =
| "SLEEP_DURATION"
| "VO2_MAX"
| "STEPS"
// The analytics `summaries` map is keyed by `MeasurementType`, so the
// gating helper reads `summaries[metric].count`. Steps are stored as
// `ACTIVITY_STEPS`; the routed sub-page + tab strip pass this key so
// the count resolves on the real DB key (mirrors how the active-energy
// surface uses `ACTIVE_ENERGY_BURNED` rather than the `ACTIVE_ENERGY`
// alias). The legacy `STEPS` / `ACTIVE_ENERGY` aliases stay for the
// metric-status registry's separate id vocabulary.
| "ACTIVITY_STEPS"
| "ACTIVE_ENERGY"
// v1.4.32 — wave-A HealthKit metrics promoted to first-class sub-pages.
| "HEART_RATE_VARIABILITY"
+6
View File
@@ -66,6 +66,11 @@ const SUB_PAGE_METRIC = {
"visceral-fat": ["VISCERAL_FAT"],
"lean-body-mass": ["LEAN_BODY_MASS"],
// ── activity ──
// v1.12 — Steps gains a routed sub-page. Stored as `ACTIVITY_STEPS`;
// the tile already surfaced on the dashboard but the metric was never
// listed here, so it never appeared in the Insights tab strip / sub-page
// nav despite the user having step data.
steps: ["ACTIVITY_STEPS"],
"active-energy": ["ACTIVE_ENERGY_BURNED"],
// v1.4.32 — workouts surface; the page reads `Workout` rows directly
// through `useWorkouts()` rather than the `summaries` map, so the
@@ -161,6 +166,7 @@ export const SUB_PAGE_GROUP: Partial<Record<SubPageSlug, SubPageGroup>> = {
"visceral-fat": "body",
"lean-body-mass": "body",
// activity / mobility (v1.7.0)
steps: "activity",
"flights-climbed": "activity",
"walking-distance": "activity",
"walking-steadiness": "activity",