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
Follow-up to !140: a weighted pull-up counts the lifter, not just the belt
Duarte Santosd71e045eacff
diff --git a/frontend/src/lib/structuralBalance.js b/frontend/src/lib/structuralBalance.jsindex 1af493edc..6ffa3ddbe 100644--- a/frontend/src/lib/structuralBalance.js+++ b/frontend/src/lib/structuralBalance.js@@ -1,7 +1,7 @@import { estimate1RM } from './onerm.js'import { LB_TO_KG } from './recovery.js'import { isBw } from './history.js'-import { isAssisted } from './exercises.js'+import { EXIDX, isAssisted } from './exercises.js'import { isSideSet, isWarmupRow } from './workout-model.js'import { BALANCE_STATUSES, BORDERLINE_BAND_PCT, EVALUATION_MODES } from './structuralBalanceTemplates.js'@@ -22,6 +22,18 @@ export function bodyweightKgOf(S) {// every screen.const isAssistedEntry = entry => isAssisted(entry?.id ? { id: entry.id } : entry)+// The catalogue's belt-and-vest variants of the hanging and supported movements ("weighted+// pull-up", "weighted straight bar dip"): 'weighted' equipment rather than body weight, so+// isBw() reads them as ordinary load, yet what is logged is the plate on the belt — the same+// added weight a bodyweight entry holds. Poliquin's supine pull-up role lists one (0841); read+// as the belt alone, +20 kg for 5 would score a 23 kg pull-up. Bench dips and push-ups keep the+// feet down and stay out, as does everything else on 'weighted' (a plate held for a crunch).+const LIFTER_MOVEMENT = /\b(pull[- ]?ups?|chin[- ]?ups?|muscle[- ]?ups?|dips?)\b/i+const beltOnLifter = id => {+ const ex = EXIDX[id]+ return ex?.eq === 'weighted' && LIFTER_MOVEMENT.test(ex.n) && !/\bbench/i.test(ex.n)+}+// What one completed set actually moved, in kg. On a bodyweight-configured entry `w` holds only// what was *added* (history.js: "`w` means *added* weight"), so the lifter's own mass has to be// added back: a chin-up with +10 kg is not a 10 kg lift, and Poliquin's dip/pull-up ratios are@@ -43,7 +55,8 @@ function setLoadKg(S, workout, entry, set, bodyweightKg) {return body - logged > 0 ? body - logged : null}const bodyweight = entry.target?.bodyweight ?? entry.bodyweight- if (!isBw({ id: entry.id, bodyweight })) return logged+ const onLifter = bodyweight == null ? isBw({ id: entry.id }) || beltOnLifter(entry.id) : !!bodyweight+ if (!onLifter) return loggedreturn body > 0 ? body + logged : null}diff --git a/frontend/src/lib/structuralBalance.test.js b/frontend/src/lib/structuralBalance.test.jsindex 3708d2045..e3c7e0100 100644--- a/frontend/src/lib/structuralBalance.test.js+++ b/frontend/src/lib/structuralBalance.test.js@@ -155,7 +155,7 @@ describe('resolveCurrent / resolveCurrentReps — best variant among a whitelistworkoutAt('0841', NOW, [setDone(10, 5)]), // weighted pull-up: lower est, more recent],}- const current = resolveCurrent(S, ['0032', '0841'], null)+ const current = resolveCurrent(S, ['0032', '0841'], 80)expect(current.exId).toBe('0841')expect(current.w).toBe(20)})@@ -237,6 +237,38 @@ describe('bodyweight exercises count the lifter, not just the belt', () => {})})+// The catalogue's weighted pull-up (0841, in Poliquin's supine pull-up role) is 'weighted'+// equipment, not body weight — but what is logged on it is still the belt.+describe('a belt on a pull-up or a dip counts the lifter too', () => {+ const bw80 = ids => ({ unit: 'kg', workouts: ids.map(([id, w, r], i) => workoutAt(id, NOW + i, [setDone(w, r)])) })++ it('scores the weighted pull-up as body weight plus the belt', () => {+ const S = { ...bw80([['0030', 100, 1], ['0841', 20, 1]]), bodyweight: [{ d: '2026-01-01', w: 80 }] }+ const pullups = computeBalance(S, TEMPLATES.poliquin).find(r => r.roleId === 'supinePullups')+ expect(pullups.mappedExerciseId).toBe('0841')+ expect(pullups.current.estKg).toBeCloseTo(100) // 80 + 20, not 20+ expect(pullups.status).toBe(BALANCE_STATUSES.BALANCED)+ })++ it('does the same for the other belt variants of pull-ups, chin-ups, muscle-ups and dips', () => {+ for (const id of ['0841', '2987', '3290', '3286', '3313', '1755', '1767']) {+ expect(resolveCurrent(bw80([[id, 10, 1]]), [id], 80).estKg).toBeCloseTo(90)+ }+ })++ it('leaves bench dips, push-ups and the rest of the weighted catalogue as plain load', () => {+ for (const id of ['0830', '1754', '1310', '0852', '0832']) {+ expect(resolveCurrent(bw80([[id, 10, 1]]), [id], 80).estKg).toBeCloseTo(10)+ }+ })++ it('follows the per-exercise bodyweight flag when it is set, and needs a body weight', () => {+ const off = { unit: 'kg', workouts: [{ d: '2026-01-10', start: NOW, entries: [{ id: '0841', target: { bodyweight: false }, sets: [setDone(20, 1)] }] }] }+ expect(resolveCurrent(off, ['0841'], 80).estKg).toBeCloseTo(20)+ expect(resolveCurrent(bw80([['0841', 20, 1]]), ['0841'], null)).toBe(null)+ })+})+// A role pointed at an assistance machine through the exercise picker (0017 assisted pull-up):// the logged number is the help, so it comes off the lifter instead of going on top.describe('an assistance machine counts the help against the lifter', () => {