mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
chore(release): v1.4.29.1
Daily-step aggregation hotfix. The dashboard 7-day step chart now renders daily totals (sums in the thousands), not per-sample averages, by routing cumulative HealthKit types through the sum branch of the client-side daily aggregator.
This commit is contained in:
1 parent
d76c0b56e7
commit
945b556664
6 files changed
+607
-2
No files matched your search
@@ -38,6 +38,8 @@ import type {
|
||||
ChartOverlayKey,
|
||||
ComparisonBaseline,
|
||||
} from "@/lib/dashboard-layout";
|
||||
import { CUMULATIVE_HK_TYPES } from "@/lib/measurements/apple-health-mapping";
|
||||
import type { MeasurementType } from "@/generated/prisma/client";
|
||||
import { ChartOverlayControls } from "./chart-overlay-controls";
|
||||
import { useChartOverlayPrefs } from "@/hooks/use-chart-overlay-prefs";
|
||||
import { useViewportWidth } from "@/hooks/use-viewport-width";
|
||||
@@ -629,7 +631,16 @@ export function HealthChart({
|
||||
};
|
||||
|
||||
for (const [type, stats] of Object.entries(bucket.values)) {
|
||||
point[type] = stats.sum / stats.count;
|
||||
// v1.4.29.1 — cumulative HealthKit types (steps, active energy,
|
||||
// distance, flights, daylight) must reduce with sum, not the
|
||||
// per-sample average. The server already does this when the
|
||||
// chart fetches with `aggregate=daily` (windows over 7 days);
|
||||
// the 7-day path still pulls raw rows and aggregates here,
|
||||
// so the same distinction must hold client-side.
|
||||
const isCumulative = CUMULATIVE_HK_TYPES.has(
|
||||
type as MeasurementType,
|
||||
);
|
||||
point[type] = isCumulative ? stats.sum : stats.sum / stats.count;
|
||||
}
|
||||
|
||||
return point;
|
||||
|
||||
Reference in new issue
Block a user