Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
History: editing a workout that was kept out of progression before exclusion moved onto its exercises keeps it out, instead of making it the last time the next session starts from
Duarte Santos415a2cacba0a
diff --git a/frontend/src/lib/session-edit.js b/frontend/src/lib/session-edit.jsindex 67668a2e8..cdc303e69 100644--- a/frontend/src/lib/session-edit.js+++ b/frontend/src/lib/session-edit.js@@ -48,6 +48,13 @@ export function editCompletedSession(state, ref) {const active = clone(original)active.cur = 0active.editingWorkoutId = key+ // A workout saved before exclusion moved onto the entries (ENG-11) carries only the whole-workout+ // flag. The editor rebuilds that flag from the entries (buildCompletedWorkout), so it is written+ // onto each of them here, the way a session starts since: the edited workout stays out of+ // progression, and a swap in the editor keeps its replacement out too.+ if (original.excludeFromProgression === true) {+ for (const entry of list(active.entries)) if (entry && entry.noProg !== true) entry.noProg = true+ }// Worked out again on Save, from the edited sets.for (const k of ['vol', 'prs', '_ts']) delete active[k]state.active = activediff --git a/frontend/src/lib/session-edit.test.js b/frontend/src/lib/session-edit.test.jsindex 9d33c4612..accfb9e7b 100644--- a/frontend/src/lib/session-edit.test.js+++ b/frontend/src/lib/session-edit.test.js@@ -1,6 +1,7 @@import { describe, expect, it } from 'vitest'import { editCompletedSession, saveWorkoutEdit } from './session-edit.js'import { mergeStates } from './sync-merge.js'+import { entryExcluded, lastEntryFor } from './history.js'const entry = (w, id = '0025') => ({ id, sets: [{ w, r: 5, done: true }], target: { mode: 'reps' } })const fixture = () => ({@@ -135,6 +136,23 @@ describe('saved workout editing', () => {expect(saved.entries[0].sets[0].w).toBe(50)})+ // A workout logged before exclusion moved onto the entries (ENG-11) carries only the whole-+ // workout flag. Editing it must not turn it into a regular session that the next one of the+ // exercise reads as its last time.+ it('keeps a workout saved with the old exclude-from-progression flag out of progression after an edit', () => {+ const state = fixture()+ state.workouts[0] = { ...state.workouts[0], routineId: 'main', routineIds: ['main'], entries: [entry(80)] }+ state.workouts.push({ id: 'rehab', d: '2026-09-02', start: 3000, end: 4000, routineId: 'rehab', routineIds: ['rehab'], excludeFromProgression: true, entries: [entry(10)], prs: [] })+ expect(lastEntryFor(state, '0025').sets[0].w).toBe(80)+ editCompletedSession(state, 'rehab')+ state.active.entries[0].sets[0].r = 6+ const saved = saveWorkoutEdit(state)+ expect(saved.entries.every(e => entryExcluded(saved, e) && e.noProg === true)).toBe(true)+ expect(saved.excludeFromProgression).toBe(true)+ expect(saved.entries[0].sets[0].r).toBe(6)+ expect(lastEntryFor(state, '0025').sets[0].w).toBe(80)+ })+it('stamps the edit, and the edit replaces the old copy by id in a merge whichever copy is newer', () => {const state = fixture()editCompletedSession(state, 'workout')