Skip to content

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.

An edited plan on a lift logged at 0 kg restarts at the plan's weight, not at 0

Duarte Santos37151fbf6db4
diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.js
index 1cec68b9a..c50df3626 100644
--- a/frontend/src/lib/progression.js
+++ b/frontend/src/lib/progression.js
@@ -398,12 +398,14 @@ export function nextPrescription(S, cfg, routine) {
const why = borrowed ? ['First time in this routine — starting from its own target.'] : ['Plan changed — starting from your new target.']
if (mode === 'time') return { policy, kind: 'hold', sec: cfg.sec || last.goal || undefined, why }
if (last.weight <= 0 && isBw(cfg)) return { policy, kind: 'hold', weight: 0, reps: cfg.reps || undefined, why }
+ // A loaded lift logged at 0 had no weight typed in (see below): the plan's, if it has one.
+ const held = last.weight > 0 ? { weight: last.weight } : cfg.weight > 0 ? { weight: cfg.weight } : {}
if (policy === 'double') {
const range = normalizeRepRange(cfg.reps || last.goal || 10, cfg.repsMin, repStep(cfg))
const aim = Math.min(range.reps, Math.max(range.repsMin, last.low + repStep(cfg)))
- return { policy, kind: 'hold', weight: last.weight, reps: aim, why }
+ return { policy, kind: 'hold', ...held, reps: aim, why }
}
- return { policy, kind: 'hold', weight: last.weight, reps: cfg.reps || undefined, why }
+ return { policy, kind: 'hold', ...held, reps: cfg.reps || undefined, why }
}
const stalls = stallCount(sessions, policy)
diff --git a/frontend/src/lib/progression.test.js b/frontend/src/lib/progression.test.js
index 5cc95d0cd..0a931f3bb 100644
--- a/frontend/src/lib/progression.test.js
+++ b/frontend/src/lib/progression.test.js
@@ -733,6 +733,11 @@ describe('an edited plan restarts progression (#275)', () => {
expect(p.why[0]).toBe('First time in this routine — starting from its own target.')
})
+ it('opens a loaded lift logged at 0 kg at the plan\'s weight when the plan changed', () => {
+ const S = { unit: 'kg', workouts: [logged(LIFT, { sets: 2, reps: 15, weight: 0 }, { sets: 2, reps: 15, weight: 0 }, 0, [15, 15])] }
+ expect(nextPrescription(S, { id: LIFT, sets: 2, reps: 10, weight: 50, prog: 'linear' }, R)).toMatchObject({ kind: 'hold', weight: 50, reps: 10 })
+ })
+
it('continues another routine\'s progression when its plan is the same one (a copied routine)', () => {
const B = { d: '2026-04-01', routineIds: ['b'], entries: [{ id: LIFT, rid: 'b', planned: { sets: 2, reps: 10, weight: 60 }, target: { sets: 2, reps: 10, weight: 60 }, sets: [{ w: 60, r: 10, done: true }, { w: 60, r: 10, done: true }] }] }
expect(nextPrescription({ unit: 'kg', workouts: [B] }, { id: LIFT, sets: 2, reps: 10, weight: 60, prog: 'linear' }, { id: 'copy', ex: [] }))