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
Bodyweight: a set count from before plans were stamped no longer outlives a cut plan (#33)
Duarte Santos5ebb33701dc2
diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.jsindex fd3365066..2d4a5d8bd 100644--- a/frontend/src/lib/progression.js+++ b/frontend/src/lib/progression.js@@ -438,9 +438,11 @@ export function nextPrescription(S, cfg, routine) {const goal = last.goal || cfg.reps || 0// The set count this has reached: the plan's, or more once the ceiling below added sets.// Read off the last session's target, or the added set lasted one session and the next- // clean one dropped back to the plan's count (issue #33 means it to stay).+ // clean one dropped back to the plan's count (issue #33 means it to stay). Only a session+ // that stamped its plan can say so — this plan, or it would have restarted above. An older+ // one's target may hold a set count from a plan cut since, and it would be kept for good.const planSets = Math.max(1, cfg.sets || 1)- const reached = Math.max(planSets, (last.target && last.target.sets) || 0)+ const reached = last.planned ? Math.max(planSets, (last.target && last.target.sets) || 0) : planSetsconst keep = reached > planSets ? { sets: reached } : {}if (!last.ok || goal <= 0) return { policy, kind: 'hold', weight: 0, reps: goal || undefined, ...keep, why: ['Bodyweight — same target again until every set is clean.'] }// A ceiling turns "+1 rep forever" into a plan (issue #33). Past the top of the range thediff --git a/frontend/src/lib/progression.test.js b/frontend/src/lib/progression.test.jsindex 90beebe19..a4b1e2d1e 100644--- a/frontend/src/lib/progression.test.js+++ b/frontend/src/lib/progression.test.js@@ -333,14 +333,27 @@ describe('bodyweight exercises', () => {})it('keeps a set the ceiling added: the next clean session climbs reps at the new count (issue #33)', () => {- const grown = hist(LIFT, [[0, 10, 10, 10, 10]], { sets: 4, reps: 10 })+ const grown = stamped(hist(LIFT, [[0, 10, 10, 10, 10]], { sets: 4, reps: 10 }), plannedOf(cfg))const p = nextPrescription(grown, { ...cfg, repsMax: 15 })expect(p).toMatchObject({ kind: 'up', reps: 11, sets: 4 })// and a miss holds that count too- const missed = hist(LIFT, [[0, 10, 10, 10, 8]], { sets: 4, reps: 10 })+ const missed = stamped(hist(LIFT, [[0, 10, 10, 10, 8]], { sets: 4, reps: 10 }), plannedOf(cfg))expect(nextPrescription(missed, { ...cfg, repsMax: 15 })).toMatchObject({ kind: 'hold', reps: 10, sets: 4 })})+ // A session saved before plans were stamped cannot say which plan its set count grew from: a+ // routine cut from 4 sets to 3 before the upgrade would otherwise open at 4 for good, since+ // every session after re-stamps that 4 against an unchanged plan of 3.+ it('opens at the plan\'s set count after an older session with more sets', () => {+ const legacy = hist(LIFT, [[0, 10, 10, 10, 10]], { sets: 4, reps: 10 })+ const clean = nextPrescription(legacy, { ...cfg, repsMax: 15 })+ expect(clean).toMatchObject({ kind: 'up', reps: 11 })+ expect(clean.sets).toBeUndefined()+ const missed = nextPrescription(hist(LIFT, [[0, 10, 10, 10, 8]], { sets: 4, reps: 10 }), { ...cfg, repsMax: 15 })+ expect(missed).toMatchObject({ kind: 'hold', reps: 10 })+ expect(missed.sets).toBeUndefined()+ })+it('still adds load the moment the exercise is actually weighted', () => {const p = nextPrescription(hist(LIFT, [[10, 10, 10, 10]], { sets: 3, reps: 10 }), cfg)expect(p.kind).toBe('up')