Fix rebucketing, seed upgrades, watch pruning, end re-stamping; add model tests
Editing a workout's start date now removes the file at its old month bucket so the record no longer duplicates on the next reconcile. Seed reconcile re-checks the tombstone veto before overwriting an upgraded seed. The watch applies authoritative-empty pushes so remote deletes prune, and a re-saved finished workout keeps its original end time. Adds unit tests for the mappers, path bucketing, and status machine. Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
This commit is contained in:
@@ -118,8 +118,13 @@ extension WorkoutDocument {
|
||||
let anyStarted = statuses.contains { $0 != .notStarted }
|
||||
|
||||
if allResolved {
|
||||
// Only stamp the finish time on the *transition* into completed. A workout
|
||||
// that was already completed (with an `end`) keeps that original end, so
|
||||
// editing a finished workout — which re-runs this recompute with all logs
|
||||
// still resolved — doesn't jump its end forward to now.
|
||||
let wasCompletedWithEnd = status == WorkoutStatus.completed.rawValue && end != nil
|
||||
status = WorkoutStatus.completed.rawValue
|
||||
end = Date()
|
||||
if !wasCompletedWithEnd { end = Date() }
|
||||
} else if anyStarted {
|
||||
status = WorkoutStatus.inProgress.rawValue
|
||||
end = nil
|
||||
|
||||
Reference in New Issue
Block a user