Merge develop -> main: full session (KC-51 through KC-71) #28

Merged
kutesir merged 64 commits from develop into main 2026-07-12 22:57:14 +00:00
2 changed files with 30 additions and 5 deletions
Showing only changes of commit 017937bbff - Show all commits

View File

@@ -1739,3 +1739,25 @@ on all these to avoid accidentals."
just 100%) now also confirms before executing — previously instant/silent. just 100%) now also confirms before executing — previously instant/silent.
Files: `WorkoutView.swift`. 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`.

View File

@@ -818,7 +818,9 @@ class WorkoutViewModel: ObservableObject {
sessionStartDate = Date() sessionStartDate = Date()
} }
syncBack() 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() } if wasMarkedDone && restTimerEnabled { startRestTimer() }
} }
@@ -832,11 +834,13 @@ class WorkoutViewModel: ObservableObject {
} }
if done, sessionStartDate == nil { sessionStartDate = Date() } if done, sessionStartDate == nil { sessionStartDate = Date() }
syncBack() 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 /// Mark every set of the active workout done/undone the "Check/Clear all
/// complete" quick action. Logs completion when everything is checked. /// 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) { func setAllSetsDone(_ done: Bool) {
for si in activeSections.indices { for si in activeSections.indices {
for ei in activeSections[si].exercises.indices { for ei in activeSections[si].exercises.indices {
@@ -850,7 +854,6 @@ class WorkoutViewModel: ObservableObject {
UserDefaults.kisani.set(iso.string(from: Date()), forKey: kLastActiveDay) UserDefaults.kisani.set(iso.string(from: Date()), forKey: kLastActiveDay)
} }
syncBack() syncBack()
if done, doneSets == totalSets && totalSets > 0 { logWorkoutCompleted() }
} }
func addSet(sectionId: UUID, to exerciseId: UUID) { func addSet(sectionId: UUID, to exerciseId: UUID) {