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:
kutesir
2026-06-08 00:29:48 +03:00
parent 966c1b35e9
commit d09a6c1fe3
4 changed files with 43 additions and 2 deletions

View File

@@ -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()