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
workout: plate loading, round two — per-side bar rows, "+" between plates, bands never load
Boris Kurktchiev5da80bebe85d
diff --git a/frontend/src/lib/plates.js b/frontend/src/lib/plates.jsindex 8b7a0e4c3..03c369ce4 100644--- a/frontend/src/lib/plates.js+++ b/frontend/src/lib/plates.js@@ -128,9 +128,10 @@ export function plateDelta(prev, next) {/*** How an exercise's weight is loaded: 'pairs' (a bar or a two-post machine — plates split per* side beyond the bar), 'single' (one stack: dip belt, landmine, plate-loaded machine, sled — all- * of it beyond the base weight), 'none' (dumbbells, kettlebells, cables, pin machines). The- * user's own choice in S.loadKind wins; otherwise bar equipment → pairs, body-weight and+ * of it beyond the base weight), 'none' (dumbbells, kettlebells, cables, pin machines, bands).+ * The user's own choice in S.loadKind wins; otherwise bar equipment → pairs, body-weight and* "weighted" exercises and sleds → single (the added load is what you hang on), the rest → none.+ * A band's "weight" is its tension, not plates, so bands are none even though isBw counts them.*/export function loadKindFor(S, cfgOrId) {const cfg = typeof cfgOrId === 'string' ? { id: cfgOrId } : (cfgOrId || {})@@ -138,6 +139,7 @@ export function loadKindFor(S, cfgOrId) {const own = S?.loadKind?.[cfg.id]if (own === 'pairs' || own === 'single' || own === 'none') return ownif (usesBar(ex)) return 'pairs'+ if (ex?.eq === 'band' || ex?.eq === 'resistance band') return 'none'if (SINGLE_EQ.has(ex?.eq) || isBw(cfg)) return 'single'return 'none'}diff --git a/frontend/src/lib/plates.test.js b/frontend/src/lib/plates.test.jsindex aa2425f82..128903ef8 100644--- a/frontend/src/lib/plates.test.js+++ b/frontend/src/lib/plates.test.js@@ -90,6 +90,9 @@ describe('loadKindFor', () => {expect(loadKindFor({}, sled)).toBe('single')expect(loadKindFor({}, db)).toBe('none')expect(loadKindFor({}, 'no-such-id')).toBe('none')+ expect(loadKindFor({}, idOf('band'))).toBe('none') // tension, not plates+ expect(loadKindFor({}, idOf('resistance band'))).toBe('none')+ expect(loadKindFor({}, { id: idOf('band'), bodyweight: true })).toBe('none')})test('a routine flagging an exercise as body-weight follows the flag', () => {diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex ef952388d..0e05c6fb5 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -205,18 +205,25 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie// three under the sets and four more below the card is a single list you open once a session.// Plate loading, per set row (lib/plates.js): which plates make THIS row's weight, from the// plates you own. 'pairs' splits what is beyond the bar per side, 'single' is one stack (a- // belt, a sled), 'none' shows nothing. A unilateral row logs each side's own weight and gets- // no line. Only reps mode has a weight to load. The rows and their drop-set sub-rows form one- // sequence in the order the bar sees them, keyed `i` for a set and `i:dN` for its N-th drop;- // a rest-pause burst keeps the set's weight, so it is not in the sequence.+ // belt, a sled), 'none' shows nothing. A unilateral row logs each side's own weight; a bar is+ // the same bar for both legs, so the line uses the sides' weight while they agree (or only one+ // side has a number yet) and stays away once they differ. Only reps mode has a weight to load.+ // The rows and their drop-set sub-rows form one sequence in the order the bar sees them, keyed+ // `i` for a set and `i:dN` for its N-th drop; a rest-pause burst keeps the set's weight, so it+ // is not in the sequence.const loadKind = mode === 'reps' ? loadKindFor(S, cfg) : 'none'const base = baseWeightFor(S, entry.id)const loadSeq = loadKind === 'none' ? [] : (() => {const inv = inventoryFor(S)const out = []entry.sets.forEach((s, i) => {- if (perSide && isSideSet(s)) return- out.push({ key: String(i), load: rowLoad(loadKind, s.w, base, inv) })+ let w = s.w+ if (perSide && isSideSet(s)) {+ const L = s.sides.L?.w || 0, R = s.sides.R?.w || 0+ if (L && R && L !== R) return+ w = L || R+ }+ out.push({ key: String(i), load: rowLoad(loadKind, w, base, inv) })dropsOf(s).forEach((d, di) => out.push({ key: i + ':d' + di, load: rowLoad(loadKind, d.w, base, inv) }))})return out@@ -235,7 +242,8 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFiewhile (p >= 0 && !loadSeq[p].load) p--const prev = p >= 0 ? loadSeq[p].load : nullif (prev && sameLoad(prev, L)) return null- const stack = L.plates.map(w => fmtPlate(w)).join(' · ')+ // "+" between plates: "45 + 5 per side" reads as a sum, a dot did not (Boris, 2026-09-13).+ const stack = L.plates.map(w => fmtPlate(w)).join(' + ')const text = L.barOnly ? t('Bar only'): L.kind === 'pairs' ? t('{0} per side', stack || '—') : t('Load {0}', stack || '—')const d = prev && !dense ? plateDelta(prev.plates, L.plates) : nulldiff --git a/frontend/src/views/Workout.plates.test.jsx b/frontend/src/views/Workout.plates.test.jsxindex f14d4af61..46438d347 100644--- a/frontend/src/views/Workout.plates.test.jsx+++ b/frontend/src/views/Workout.plates.test.jsx@@ -19,6 +19,8 @@ const clone = value => JSON.parse(JSON.stringify(value))const SQUAT = '0043' // barbell full squatconst DB_BENCH = '0289' // dumbbell bench pressconst COCOONS = '0260' // body weight, done here with +25+const LUNGE = '0054' // barbell lunge — the coach runs it per side+const BAND_PULL = '0993' // band pull-apart (band)// One pair of each — the home gym the coach plans for.const HOME = { 45: 1, 35: 1, 25: 1, 15: 1, 10: 1, 5: 1, 2.5: 1 }@@ -61,15 +63,38 @@ describe('plate line under set rows', () => {expect(EXIDX[SQUAT].eq).toBe('barbell')expect(EXIDX[DB_BENCH].eq).toBe('dumbbell')expect(EXIDX[COCOONS].eq).toBe('body weight')+ expect(EXIDX[LUNGE].eq).toBe('barbell')+ expect(EXIDX[BAND_PULL].eq).toBe('band')+ })++ it('a per-side bar exercise (barbell lunge): the work rows load from the sides\' shared bar', () => {+ const side = (L, R) => ({ w: Math.max(L, R), r: 16, done: false, sides: { L: { w: L, r: 8, done: false }, R: { w: R, r: 8, done: false } } })+ mount([entry(LUNGE, [warm(45), side(65, 65), side(65, 65), side(65, 0)], { w: 65, side: true })])+ expect(lines()).toEqual([+ { text: 'Bar only', moves: null },+ { text: '10 per side', moves: '+10' },+ ])+ expect(container.querySelectorAll('.setrow-side').length).toBe(3)+ })++ it('sides carrying different weights get no line', () => {+ const side = (L, R) => ({ w: Math.max(L, R), r: 16, done: false, sides: { L: { w: L, r: 8, done: false }, R: { w: R, r: 8, done: false } } })+ mount([entry(LUNGE, [side(65, 75)], { w: 65, side: true })])+ expect(lines()).toEqual([])+ })++ it('a band has no plates: no line even with a "weight" logged', () => {+ mount([entry(BAND_PULL, [work(10), work(10)], { w: 10 })])+ expect(lines()).toEqual([])})it("Monday's squat ramp: a line where the stack changes, once for the three work sets", () => {mount([entry(SQUAT, [warm(70), warm(100), warm(120), work(145), work(145), work(145)], { w: 145 })])expect(lines()).toEqual([- { text: '10 · 2.5 per side', moves: null },- { text: '25 · 2.5 per side', moves: '−10 +25' },- { text: '35 · 2.5 per side', moves: '−25 +35' },- { text: '45 · 5 per side', moves: '−35 −2.5 +45 +5' },+ { text: '10 + 2.5 per side', moves: null },+ { text: '25 + 2.5 per side', moves: '−10 +25' },+ { text: '35 + 2.5 per side', moves: '−25 +35' },+ { text: '45 + 5 per side', moves: '−35 −2.5 +45 +5' },])// The line sits under its own row: six set rows, four lines, the last two rows bare.expect(container.querySelectorAll('.setrow').length).toBe(6)@@ -111,9 +136,9 @@ describe('plate line under set rows', () => {const dropped = { w: 145, r: 6, done: false, type: 'dropset', drops: [{ w: 115, r: 8 }] }mount([entry(SQUAT, [dropped, work(145)], { w: 145 })])expect(lines()).toEqual([- { text: '45 · 5 per side', moves: null },+ { text: '45 + 5 per side', moves: null },{ text: '35 per side', moves: '−45 −5 +35' },- { text: '45 · 5 per side', moves: '−35 +45 +5' },+ { text: '45 + 5 per side', moves: '−35 +45 +5' },])// The drop's line follows its sub-row, not the main row.const sub = container.querySelector('.subrow')@@ -128,9 +153,9 @@ describe('plate line under set rows', () => {it('the compact view keeps the stacks and drops the strip/add moves', () => {mount([entry(SQUAT, [warm(70), warm(100), work(145)], { w: 145 })], { workoutView: 'compact' })expect(lines()).toEqual([- { text: '10 · 2.5 per side', moves: null },- { text: '25 · 2.5 per side', moves: null },- { text: '45 · 5 per side', moves: null },+ { text: '10 + 2.5 per side', moves: null },+ { text: '25 + 2.5 per side', moves: null },+ { text: '45 + 5 per side', moves: null },])})