diff --git a/KisaniCal/ISSUES.md b/KisaniCal/ISSUES.md index 9e5f44b..2d4632f 100644 --- a/KisaniCal/ISSUES.md +++ b/KisaniCal/ISSUES.md @@ -1739,3 +1739,25 @@ on all these to avoid accidentals." just 100%) now also confirms before executing — previously instant/silent. Files: `WorkoutView.swift`. + +### KC-52 — follow-up 3: Check/Clear all no longer auto-jumps to "done" (real bug) +User: "when you check all or clear all it shouldnt load the screen shot [the +green 'Workout logged' card]. just show the workout widget." + +### Root cause +Not a display bug — `setAllSetsDone(true)` ("Check all sets"), `toggleSet`, and +`setExerciseDone` all still auto-called `logWorkoutCompleted()` the instant +every set hit done (`doneSets == totalSets`). That's pre-redesign behavior that +now directly fights KC-52: the whole point of the new card was to make "Finish" +a single, deliberate, confirmable action — but ticking the last checkbox (or +tapping "Check all sets") silently counted the day anyway, snapping the card +straight to the green done takeover the user never asked for. + +### Fix +Removed the auto-`logWorkoutCompleted()` call from all three sites +(`toggleSet`, `setExerciseDone`, `setAllSetsDone`). Checking sets — by any +path — now only ever updates progress; **only** the card's explicit "Finish +Workout"/"Finish Anyway" (→ `markWorkoutDone`) counts the day as done. "Check +all sets" now does exactly what it says: checks the boxes, nothing more. + +Files: `ExerciseModels.swift`. diff --git a/KisaniCal/Models/ExerciseModels.swift b/KisaniCal/Models/ExerciseModels.swift index 7ff0b15..1275768 100644 --- a/KisaniCal/Models/ExerciseModels.swift +++ b/KisaniCal/Models/ExerciseModels.swift @@ -818,7 +818,9 @@ class WorkoutViewModel: ObservableObject { sessionStartDate = Date() } syncBack() - if doneSets == totalSets && totalSets > 0 { logWorkoutCompleted() } + // Ticking the last box no longer silently logs the day as done — the + // main Workout card's explicit "Finish" is the single, confirmable way + // to count today (so mis-taps here can't jump the UI into the done state). if wasMarkedDone && restTimerEnabled { startRestTimer() } } @@ -832,11 +834,13 @@ class WorkoutViewModel: ObservableObject { } if done, sessionStartDate == nil { sessionStartDate = Date() } syncBack() - if doneSets == totalSets && totalSets > 0 { logWorkoutCompleted() } + // See toggleSet: no longer auto-logs the day — "Finish" is explicit. } - /// Mark every set of the active workout done/undone — the "Select all & mark - /// complete" quick action. Logs completion when everything is checked. + /// Mark every set of the active workout done/undone — the "Check/Clear all + /// sets" quick action. Ticking every box no longer auto-logs the day as + /// done on its own; "Finish Workout" on the main card is the single, + /// confirmable action that counts today. func setAllSetsDone(_ done: Bool) { for si in activeSections.indices { for ei in activeSections[si].exercises.indices { @@ -850,7 +854,6 @@ class WorkoutViewModel: ObservableObject { UserDefaults.kisani.set(iso.string(from: Date()), forKey: kLastActiveDay) } syncBack() - if done, doneSets == totalSets && totalSets > 0 { logWorkoutCompleted() } } func addSet(sectionId: UUID, to exerciseId: UUID) {