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 the rep ceiling added stays, and a barbell logged at 0 kg no longer climbs reps like a push-up (#33)
Duarte Santos09497c041f73
diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.jsindex 3828c3a31..1cec68b9a 100644--- a/frontend/src/lib/progression.js+++ b/frontend/src/lib/progression.js@@ -424,28 +424,38 @@ export function nextPrescription(S, cfg, routine) {const w = last.weight// Bodyweight work carries no external load, so there is nothing to add or take away —// "deload your push-ups to 2.5 kg" is not advice. Progress in reps instead. This runs ahead- // of the individual policies because it is true for all of them. Note the trigger is the- // *logged* weight, not the `bw` flag: a dip done with a belt has a load to progress and- // belongs on the normal policies, and a barbell lift logged at 0 has nothing to add to.- if (w <= 0) {+ // of the individual policies because it is true for all of them. The trigger is a bodyweight+ // exercise logged without added weight: a dip done with a belt has a load to progress and+ // belongs on the normal policies.+ if (w <= 0 && isBw(cfg)) {const goal = last.goal || cfg.reps || 0- if (!last.ok || goal <= 0) return { policy, kind: 'hold', weight: 0, reps: goal || undefined, why: ['Bodyweight — same target again until every set is clean.'] }+ // 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).+ const planSets = Math.max(1, cfg.sets || 1)+ const reached = Math.max(planSets, (last.target && last.target.sets) || 0)+ const 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 the// reps go back to the bottom and a set is added instead, which is how bodyweight work// actually progresses once a set of 30 push-ups stops being a strength stimulus.const top = cfg.repsMax > 0 ? cfg.repsMax : 0if (top > 0 && goal >= top) {- const sets = Math.max(1, cfg.sets || last.count || 1) + 1+ const sets = reached + 1const bottom = Math.max(1, Math.min(cfg.reps || top, top))if (sets <= MAX_BW_SETS) return { policy, kind: 'up', weight: 0, reps: bottom, sets, why: ['{0} reps in every set — add a set and go back to {1}.', goal, bottom] }// Out of sets worth adding: more volume is no longer the answer, load or a harder// variation is — and that is a decision for a person, not a policy.- return { policy, kind: 'hold', weight: 0, reps: goal, why: ['{0} sets of {1} — time to add weight or move to a harder variation.', sets - 1, goal] }+ return { policy, kind: 'hold', weight: 0, reps: goal, ...keep, why: ['{0} sets of {1} — time to add weight or move to a harder variation.', sets - 1, goal] }}// Unilateral work steps by two, so the total stays even and both sides get the rep.const next = goal + repStep(cfg)- return { policy, kind: 'up', weight: 0, reps: next, why: ['Bodyweight — every rep last time, so go for {0} this time.', next] }+ return { policy, kind: 'up', weight: 0, reps: next, ...keep, why: ['Bodyweight — every rep last time, so go for {0} this time.', next] }}+ // A loaded lift logged at 0 had its weight never typed in — a quick-added exercise starts at+ // 0 kg. Climbing its reps as though it were a push-up turned a 2 × 10 bench into 2 × 11, 12…+ // There is nothing to progress from, so it asks for the weight: the plan's, when it has one.+ if (w <= 0) return { policy, kind: 'hold', ...(cfg.weight > 0 ? { weight: cfg.weight } : {}), why: ['No weight logged last time — enter what you lift and progression takes it from there.'] }// Epley deloads apply only to externally loaded rep work. Keep the prescribed target from the// session that stalled (falling back field-by-field to the current config), while the loggeddiff --git a/frontend/src/lib/progression.test.js b/frontend/src/lib/progression.test.jsindex 856ff6d0e..5cc95d0cd 100644--- a/frontend/src/lib/progression.test.js+++ b/frontend/src/lib/progression.test.js@@ -255,7 +255,7 @@ describe('linear progression', () => {})describe('bodyweight exercises', () => {- const cfg = { id: LIFT, sets: 3, reps: 10, weight: 0, prog: 'linear' }+ const cfg = { id: LIFT, sets: 3, reps: 10, weight: 0, prog: 'linear', bodyweight: true }const bw = rows => hist(LIFT, rows, { sets: 3, reps: 10 })it('never invents a weight to deload to — there is nothing to take off a push-up', () => {@@ -328,6 +328,15 @@ 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 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 })+ expect(nextPrescription(missed, { ...cfg, repsMax: 15 })).toMatchObject({ kind: 'hold', reps: 10, sets: 4 })+ })+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')@@ -335,6 +344,24 @@ describe('bodyweight exercises', () => {})})+// A quick-added exercise starts at 0 kg, and a bench press ticked off without typing a weight+// is logged at 0. That is a missing number, not a push-up: it must not climb reps.+describe('a loaded lift logged at 0 kg', () => {+ const zero = hist(LIFT, [[0, 10, 10, 10]], { sets: 3, reps: 10 })++ it('holds and asks for the weight instead of climbing reps', () => {+ const p = nextPrescription(zero, { id: LIFT, sets: 3, reps: 10, weight: 0, prog: 'linear' })+ expect(p.kind).toBe('hold')+ expect(p.reps).toBeUndefined()+ expect(p.weight).toBeUndefined()+ expect(p.why[0]).toMatch(/No weight logged/)+ })++ it('falls back to the plan\'s weight when the routine has one', () => {+ expect(nextPrescription(zero, { id: LIFT, sets: 3, reps: 10, weight: 60, prog: 'double' })).toMatchObject({ kind: 'hold', weight: 60 })+ })+})+describe('Greyskull LP', () => {const cfg = { id: LIFT, sets: 3, reps: 5, weight: 60, prog: 'greyskull' }diff --git a/frontend/src/lib/session-start.plan.test.js b/frontend/src/lib/session-start.plan.test.jsindex 69a2dc337..720762b90 100644--- a/frontend/src/lib/session-start.plan.test.js+++ b/frontend/src/lib/session-start.plan.test.js@@ -193,6 +193,29 @@ describe('an edited routine starts again from its new plan', () => {})})+describe('bodyweight progression and a lift logged without a weight', () => {+ const PUSHUP = '0662' // push-up — body-weight equipment++ it('adds a set at the rep ceiling and keeps it: 2 × 10, 2 × 11, 3 × 10, 3 × 11, 4 × 10 (#33)', () => {+ const st = state([{ id: 'A', name: 'A', ex: [{ id: PUSHUP, sets: 2, reps: 10, repsMax: 11, weight: 0, bodyweight: true }] }])+ const shape = []+ for (let i = 0; i < 5; i++) {+ const [e] = start(st, ['A'])+ shape.push(`${work(e).length}x${reps(e)[0]}`)+ train(st, ['A'])+ }+ expect(shape).toEqual(['2x10', '2x11', '3x10', '3x11', '4x10'])+ })++ it('does not climb reps on a loaded lift whose rows were logged at 0 kg', () => {+ const st = state([{ id: 'A', name: 'A', ex: [{ id: BENCH, sets: 2, reps: 10, weight: 0 }] }])+ train(st, ['A'])+ const [e] = start(st, ['A'])+ expect(e.plan.kind).toBe('hold')+ expect(reps(e)).toEqual([10, 10])+ })+})+describe('"Your last session" keeps the old carry-over', () => {it('opens at the reps logged last time, judged against the plan', () => {const st = state([{ id: 'A', name: 'A', ex: [{ id: BENCH, sets: 2, reps: 10, weight: 50 }] }], { startFrom: 'last' })