Fix: per-date workout completion in calendar (KC-10)
The calendar marked every occurrence of a program complete once any one was finished — including future dates — because DayTimelineView read the program's live shared doneSets. - Add WorkoutViewModel.isWorkoutComplete(on:) backed by workoutDates. - DayTimelineView takes workoutDone and uses it instead of live sets; Calendar passes the selected date's state, Today passes today's. - A date now shows complete only if that specific date was finished. Log KC-10 in ISSUES.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -485,6 +485,13 @@ class WorkoutViewModel: ObservableObject {
|
||||
/// or detected from Apple Health (both land in `workoutDates`).
|
||||
var isTodayRecorded: Bool { workoutDates.contains(iso.string(from: Date())) }
|
||||
|
||||
/// Whether a workout was actually completed on a specific calendar date.
|
||||
/// Per-date (from `workoutDates`), NOT the program's live set state — so
|
||||
/// finishing one occurrence never marks other days of the same program.
|
||||
func isWorkoutComplete(on date: Date) -> Bool {
|
||||
workoutDates.contains(iso.string(from: date))
|
||||
}
|
||||
|
||||
// MARK: - Program management
|
||||
func switchProgram(to id: UUID) {
|
||||
syncBack()
|
||||
|
||||
Reference in New Issue
Block a user