analytics(healthkit): wire historical HealthKit reference into reports (KC-51 ph4e)
Some checks failed
CI / build-and-test (push) Has been cancelled
Some checks failed
CI / build-and-test (push) Has been cancelled
Completes 'available HealthKit trends' for weekly/monthly reports. Adds HealthKitManager.dailyReference (3 parallel bucketed HKStatisticsCollectionQuery for steps/active-calories/resting-HR over ~13 months), AnalyticsService. refreshHealthReference to cache and merge it into DaySamples, and avgSteps/ avgActiveCalories/avgRestingHR on PeriodSummary (nil when absent — honest). Surfaced in AnalyticsView's weekly/monthly cards. Verified standalone (swiftc, 8/8): aggregation correct when present, nil when absent, workout metrics unaffected, reports stay deterministic. Tests added to AnalyticsEngineTests. This completes all analytics logic — remaining work is the first Xcode build (device, user-run) to catch any SwiftUI compile issues. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,8 @@ struct ContentView: View {
|
||||
Task {
|
||||
await workoutVM.syncFromHealthKit()
|
||||
NotificationManager.shared.reschedule(workoutVM: workoutVM, taskVM: taskVM)
|
||||
await AnalyticsService.shared.refreshHealthReference()
|
||||
AnalyticsService.shared.reconcile(using: workoutVM)
|
||||
}
|
||||
}
|
||||
.onChange(of: scenePhase) { phase in
|
||||
|
||||
Reference in New Issue
Block a user