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 exercises ask for no weight step (#583)
Duarte Santosede55eaf61bd
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.jsindex f9831836e..9b93bcaa5 100644--- a/frontend/src/locales/ar.js+++ b/frontend/src/locales/ar.js@@ -2386,4 +2386,6 @@ export default {'Remove “{0}”': 'إزالة «{0}»','That’s plenty of backups.': 'هذا عدد كافٍ من البدائل.','Your backups': 'بدائلك',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'لا وزن يُضاف هنا: يزيد التمرين بالتكرارات ثم بالمجموعات.',}diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.jsindex 53dc79aa1..c09036625 100644--- a/frontend/src/locales/bn.js+++ b/frontend/src/locales/bn.js@@ -2410,4 +2410,6 @@ export default {'Remove “{0}”': '“{0}” সরান','That’s plenty of backups.': 'এতগুলো বিকল্পই যথেষ্ট।','Your backups': 'আপনার বিকল্প',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'এখানে ওজন যোগ করার কিছু নেই: আগে রেপ বাড়বে, তারপর সেট।',}diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 76e980877..279e4fd3e 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -2351,4 +2351,6 @@ export default {'Remove “{0}”': '„{0}“ entfernen','That’s plenty of backups.': 'Das sind genug Ausweichübungen.','Your backups': 'Deine Ausweichübungen',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Hier kommt kein Gewicht dazu: Es geht über Wiederholungen nach oben, dann über Sätze.',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 8c34b77df..7839e7435 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': 'Quitar «{0}»','That’s plenty of backups.': 'Ya son bastantes sustitutos.','Your backups': 'Tus sustitutos',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Aquí no hay peso que sumar: sube en repeticiones y luego en series.',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex ab3421393..44b678b18 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': 'Retirer « {0} »','That’s plenty of backups.': 'Ça fait assez de remplaçants.','Your backups': 'Tes remplaçants',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Pas de poids à ajouter ici : ça monte en répétitions, puis en séries.',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 8dbbaca1d..9bdcbbef6 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': '“{0}” हटाएँ','That’s plenty of backups.': 'इतने विकल्प काफ़ी हैं।','Your backups': 'आपके विकल्प',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'यहाँ वज़न जोड़ने की ज़रूरत नहीं: पहले रेप्स बढ़ेंगे, फिर सेट।',}diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex a3e24bcf8..bdc46d23f 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -2334,4 +2334,6 @@ export default {'Remove “{0}”': '„{0}” eltávolítása','That’s plenty of backups.': 'Ennyi helyettesítő bőven elég.','Your backups': 'A helyettesítőid',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Itt nincs mit súlyban hozzáadni: előbb az ismétlések nőnek, aztán a sorozatok.',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 1f08205ee..983f55b4a 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': 'Rimuovi «{0}»','That’s plenty of backups.': 'Bastano così, i sostituti.','Your backups': 'I tuoi sostituti',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Qui non c’è peso da aggiungere: si sale con le ripetizioni, poi con le serie.',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 4518a6754..967a49791 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': '“{0}” 빼기','That’s plenty of backups.': '대체 운동은 이 정도면 충분해요.','Your backups': '내 대체 운동',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': '여기엔 더할 무게가 없어요. 반복 수를 늘리고, 그다음 세트를 늘려요.',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 3f18d4809..040ba5ad3 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': 'Usuń „{0}”','That’s plenty of backups.': 'Tyle zamienników wystarczy.','Your backups': 'Twoje zamienniki',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Tu nie ma czego dokładać w ciężarze: rosną powtórzenia, potem serie.',}diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex 5eb2f1fdd..8811ac7d9 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -1470,6 +1470,8 @@ export const PT_BR_OVERRIDES = {'Machine taken? Pick what you’d do instead, and a swap mid-workout offers these first.': 'Máquina ocupada? Escolha o que você faria no lugar dela, e uma troca no meio do treino mostra estes primeiro.','Remove “{0}”': 'Remover “{0}”','Your backups': 'Seus substitutos',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Aqui não há peso para acrescentar: sobe em repetições e depois em séries.',}export default { ...pt, ...PT_BR_OVERRIDES }diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex d44ebd804..2f5c3c597 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': 'Remover «{0}»','That’s plenty of backups.': 'Já chega de substitutos.','Your backups': 'Os teus substitutos',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Aqui não há peso a acrescentar: sobe em repetições e depois em séries.',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 8dfd597cf..f7dd91f6d 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -2335,4 +2335,6 @@ export default {'Remove “{0}”': 'Убрать «{0}»','That’s plenty of backups.': 'Замен уже достаточно.','Your backups': 'Ваши замены',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Здесь нечего добавлять в весе: растут повторения, потом подходы.',}diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 2864869f3..3170cdb74 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -2342,4 +2342,6 @@ export default {'Remove “{0}”': 'เอา “{0}” ออก','That’s plenty of backups.': 'ท่าสำรองเท่านี้ก็พอแล้ว','Your backups': 'ท่าสำรองของคุณ',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'ท่านี้ไม่ต้องเพิ่มน้ำหนัก: เพิ่มจำนวนครั้งก่อน แล้วค่อยเพิ่มเซ็ต',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 332efb9be..ea9cc86f1 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': '“{0}” kaldır','That’s plenty of backups.': 'Bu kadar yedek yeter.','Your backups': 'Yedeklerin',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Burada eklenecek ağırlık yok: önce tekrar, sonra set artar.',}diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.jsindex b660bea6f..619c2d30f 100644--- a/frontend/src/locales/uk.js+++ b/frontend/src/locales/uk.js@@ -2328,4 +2328,6 @@ export default {'Remove “{0}”': 'Прибрати «{0}»','That’s plenty of backups.': 'Замін уже досить.','Your backups': 'Ваші заміни',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': 'Тут нічого додавати у вазі: ростуть повторення, потім підходи.',}diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.jsindex d6e91ef3d..cf63faff7 100644--- a/frontend/src/locales/zh-TW.js+++ b/frontend/src/locales/zh-TW.js@@ -2324,4 +2324,6 @@ export default {'Remove “{0}”': '移除「{0}」','That’s plenty of backups.': '備選動作已經夠多了。','Your backups': '你的備選動作',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': '這裡不用加重量:先加次數,再加組數。',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 4feffcd0d..08facea50 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -2331,4 +2331,6 @@ export default {'Remove “{0}”': '移除“{0}”','That’s plenty of backups.': '备选动作已经够多了。','Your backups': '你的备选动作',+ // --- #583 bodyweight step ---+ 'Nothing to add in weight here: it goes up in reps, then sets.': '这里不用加重量:先加次数,再加组数。',}diff --git a/frontend/src/sheets.config-bw-step.test.jsx b/frontend/src/sheets.config-bw-step.test.jsxnew file mode 100644index 000000000..2dc9c7536--- /dev/null+++ b/frontend/src/sheets.config-bw-step.test.jsx@@ -0,0 +1,50 @@+// @vitest-environment happy-dom+import React, { act } from 'react'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { createRoot } from 'react-dom/client'+import { EXIDX } from './lib/exercises.js'+import { useStore } from './store/useStore.js'+import { useUI } from './store/useUI.js'+import { exConfigSheet } from './sheets.jsx'++/* #583: a bodyweight exercise with nothing added has no weight to step up, so the progression+ asks for no Step there; it climbs in reps, then sets. A weighted one keeps its Step. */+const mounted = []+function render(sheet) {+ const host = document.createElement('div')+ document.body.appendChild(host)+ const root = createRoot(host)+ mounted.push([root, host])+ act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))+ return host+}+const save = host => [...host.querySelectorAll('button')].find(b => b.textContent.trim() === 'Save')+const hasStep = host => host.textContent.includes('Step (kg)')++beforeEach(() => {+ globalThis.IS_REACT_ACT_ENVIRONMENT = true+ useUI.setState({ sheets: [] })+ useStore.setState(s => ({ S: { ...s.S, unit: 'kg' } }))+ document.body.innerHTML = ''+})+afterEach(() => { act(() => { mounted.splice(0).forEach(([root, host]) => { root.unmount(); host.remove() }) }) })++describe('the progression step on bodyweight work (#583)', () => {+ it('push-ups with nothing added: no step, a word on how it climbs, and Save works even with a step of 0 stored', () => {+ const onSave = vi.fn()+ exConfigSheet(EXIDX['0662'], { sets: 3, reps: 10, weight: 0, mode: 'reps', prog: 'linear', inc: 0 }, onSave)+ const host = render(useUI.getState().sheets.at(-1))+ expect(hasStep(host)).toBe(false)+ expect(host.textContent).toContain('it goes up in reps, then sets')+ expect(save(host).disabled).toBe(false)+ act(() => save(host).click())+ // what was stored stays as it was+ expect(onSave.mock.calls[0][0]).toMatchObject({ prog: 'linear' })+ })+ it('push-ups with a vest on (weight added) and a barbell lift keep the step', () => {+ exConfigSheet(EXIDX['0662'], { sets: 3, reps: 10, weight: 10, mode: 'reps', prog: 'linear' }, vi.fn())+ expect(hasStep(render(useUI.getState().sheets.at(-1)))).toBe(true)+ exConfigSheet(EXIDX['0025'], { sets: 3, reps: 8, weight: 60, mode: 'reps', prog: 'linear' }, vi.fn())+ expect(hasStep(render(useUI.getState().sheets.at(-1)))).toBe(true)+ })+})diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 804ecdc16..b92908acb 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -1559,8 +1559,11 @@ export const equipmentProfileSheet = profile => ui().openSheet(close => <Equipmeconst progressionStepOf = (c, mode, ex, unit) =>c.inc >= 0 ? c.inc : (mode === 'time' ? 5 : defaultIncrement(ex.id, unit))// Back-off sets step down by the same Step, so a plan using them needs one even with no rule.-const progressionStepIsValid = (step, policy, backoff = false) =>- (policy === 'off' && !backoff) || (Number.isFinite(step) && step > 0)+// Bodyweight reps with nothing added (#583) have no load to step: they climb in reps, then sets+// (lib/progression.js climbsReps), so no step is asked for there.+const progressionStepIsValid = (step, policy, backoff = false, weightless = false) =>+ weightless || (policy === 'off' && !backoff) || (Number.isFinite(step) && step > 0)+const weightlessOf = (c, mode, bw) => mode === 'reps' && bw && !(Number(c.weight) > 0)// Back-off sets (lib/backoff.js) are offered where there is a load to step down: rep work on a// loaded exercise, not a pyramid (it owns each set), not a rest-pause (one work set), not an// assistance machine (less load is harder there).@@ -1584,7 +1587,8 @@ function ProgressionFields({ ex, mode, c, setC, routine, unit, perSide, bw }) {const inc = progressionStepOf(c, mode, ex, unit)const canBackoff = backoffOffered(c, mode, ex, bw)const backoff = canBackoff && c.backoff === true- const invalid = !progressionStepIsValid(inc, active, backoff)+ const weightless = weightlessOf(c, mode, bw)+ const invalid = !progressionStepIsValid(inc, active, backoff, weightless)// "26 → 24 → 22 kg": what the sets will open at, from the weight and step typed above.const preview = backoff && c.weight > 0 && inc > 0? backoffWeights(c.weight, Math.max(1, Math.round(c.sets) || 1), inc).map(fmtNum).join(' → ') + ' ' + unit@@ -1618,10 +1622,11 @@ function ProgressionFields({ ex, mode, c, setC, routine, unit, perSide, bw }) {<div className="small dim" style={{ marginBottom: active === 'off' ? 18 : 10 }}>{t(POLICY_DESC[active])}</div>{/* Double progression on a weighted exercise fills this row with four steppers; `cfgrow-4`lets it wrap into two pairs on phones, where four abreast left the inputs a few px wide. */}- {(active !== 'off' || backoff) && <div className={'row cfgrow' + ((active === 'double' && epleyEligible) || active === 'triple' ? ' cfgrow-4' : '')} style={{ marginBottom: 18 }}>- <Stepper label={mode === 'time' ? t('Step (seconds)') : t('Step ({0})', unit)} value={inc}+ {weightless && active !== 'off' && <div className="small dim" style={{ marginBottom: 12 }}>{t('Nothing to add in weight here: it goes up in reps, then sets.')}</div>}+ {(active !== 'off' || backoff) && (!weightless || climbsRange(active) || active === 'triple') && <div className={'row cfgrow' + ((active === 'double' && epleyEligible) || active === 'triple' ? ' cfgrow-4' : '')} style={{ marginBottom: 18 }}>+ {!weightless && <Stepper label={mode === 'time' ? t('Step (seconds)') : t('Step ({0})', unit)} value={inc}step={mode === 'time' ? 5 : 1.25} decimal={mode !== 'time'} invalid={invalid} className={invalid ? 'invalid' : ''}- onChange={v => setC(x => ({ ...x, inc: v }))} />+ onChange={v => setC(x => ({ ...x, inc: v }))} />}{climbsRange(active) && <>{/* The draft stays as typed: normalising on every keystroke turned "12" into 92 (the"1" was pulled above the lower bound first). Save and the engine normalise anyway. */}@@ -1717,7 +1722,7 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, iconst pyramid = mode === 'reps' && isPyramid({ ...c, mode })const setPyramidAt = (i, v) => setC(x => ({ ...x, pyramid: x.pyramid.map((p, j) => (j === i ? v : p)) }))const progressionPolicy =policyFor({ ...c, id: ex.id }, routine, mode)- const progressionStepInvalid = !progressionStepIsValid(progressionStepOf(c, mode, ex, st.unit), progressionPolicy, c.backoff === true && backoffOffered(c, mode, ex, bw))+ const progressionStepInvalid = !progressionStepIsValid(progressionStepOf(c, mode, ex, st.unit), progressionPolicy, c.backoff === true && backoffOffered(c, mode, ex, bw), weightlessOf(c, mode, bw))const activePolicy = policyFor({ ...c, id: ex.id }, routine, mode)// Both climb a range: the flat Reps stepper gives way to "Reps from" / "Reps up to".const ranged = mode === 'reps' && climbsRange(activePolicy)diff --git a/frontend/src/sheets.progression-row.test.jsx b/frontend/src/sheets.progression-row.test.jsxindex 52a83bfea..d036600c3 100644--- a/frontend/src/sheets.progression-row.test.jsx+++ b/frontend/src/sheets.progression-row.test.jsx@@ -47,9 +47,12 @@ describe('exercise configuration progression row', () => {const linear = renderConfig({ prog: 'linear' })expect(linear.row.querySelectorAll('.stp-w')).toHaveLength(2)expect(linear.row.classList.contains('cfgrow-4')).toBe(false)- // double on a body-weight exercise: no Epley deload, three steppers+ // double on a body-weight exercise with nothing added: no Epley deload, and no weight Step+ // either (#583), so just the rep rangeconst bw = renderConfig({ prog: 'double', weight: 0, bodyweight: true })- expect(bw.row.querySelectorAll('.stp-w')).toHaveLength(3)- expect(bw.row.classList.contains('cfgrow-4')).toBe(false)+ expect(bw.row).toBeUndefined()+ const range = [...bw.host.querySelectorAll('.cfgrow')].find(r => r.querySelector('.stp-l')?.textContent === 'Reps from')+ expect(range.querySelectorAll('.stp-w')).toHaveLength(2)+ expect(range.classList.contains('cfgrow-4')).toBe(false)})})