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
Cardio exercises can be logged as sets x reps or timed (#678)
Duarte Santos70ccc483d435
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3a9bcec75..746294bd9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -38,6 +38,10 @@ with the muscles it works lit up. No more opening Leg Day to remember it is, inGitHub Sponsors, and on the iPhone a straight line to writing an App Store review. No pop-upsasking for anything, promise.+**Fixes**+- Jumping jacks, burpees and the other cardio moves can be counted in sets x reps (or timed):+ their settings now offer Cardio, Reps and Time, Cardio still the default (#678).+## v1.4.2 (2026-10-18)openGym comes to the App Store, with an Apple Watch app in tow. Plus everything you asked fordiff --git a/frontend/src/lib/routines.js b/frontend/src/lib/routines.jsindex 8c31701bd..fe1df25a1 100644--- a/frontend/src/lib/routines.js+++ b/frontend/src/lib/routines.js@@ -196,7 +196,7 @@ function setupOf(entry) {restSec: Math.max(0, Math.round(Number(target.restSec)) || 0),note: String(target.note || '').trim().slice(0, NOTE_MAX),}- if (!isCardio(entry.id) && target.intensifier?.type !== 'restpause') {+ if (modeOf({ ...target, id: entry.id }) !== 'cardio' && target.intensifier?.type !== 'restpause') {out.warmupSets = Math.min(MAX_PLANNED_WARMUPS, (entry.sets || []).filter(isWarmupRow).length)}return outdiff --git a/frontend/src/sheets.config-cardio-mode.test.jsx b/frontend/src/sheets.config-cardio-mode.test.jsxnew file mode 100644index 000000000..922f07847--- /dev/null+++ b/frontend/src/sheets.config-cardio-mode.test.jsx@@ -0,0 +1,79 @@+// @vitest-environment happy-dom+// A cardio exercise can be counted in sets x reps (#678): jumping jacks are filed under cardio in+// the catalogue, which used to lock them to Intervals, Minutes and Speed. Their settings now offer+// Cardio, Reps and Time, Cardio still the default.+import React, { act } from 'react'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { createRoot } from 'react-dom/client'+import { EXDB, EXIDX } from './lib/exercises.js'+import { modeOf } from './lib/history.js'+import { DEF, useStore } from './store/useStore.js'+import { useUI } from './store/useUI.js'+import { exConfigSheet } from './sheets.jsx'++const JUMPING_JACK = '3094'+const mounted = []+function open(ex, existing) {+ useStore.setState({ S: structuredClone(DEF), user: null })+ const onSave = vi.fn()+ exConfigSheet(ex, existing, onSave, null, null)+ const sheet = useUI.getState().sheets.at(-1)+ const host = document.createElement('div')+ document.body.appendChild(host)+ const root = createRoot(host)+ mounted.push(root)+ act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))+ const modes = () => [...host.querySelectorAll('.seg-range button')].map(b => b.textContent.trim())+ const picked = () => host.querySelector('.seg-range button.on')?.textContent.trim()+ const pick = label => act(() => [...host.querySelectorAll('.seg-range button')].find(b => b.textContent.trim() === label).click())+ const labels = () => [...host.querySelectorAll('.stp-l')].map(l => l.textContent.trim())+ const save = () => act(() => [...host.querySelectorAll('button')].find(b => b.textContent.trim() === 'Save').click())+ return { modes, picked, pick, labels, save, onSave }+}++beforeEach(() => {+ globalThis.IS_REACT_ACT_ENVIRONMENT = true+ useUI.setState({ sheets: [] })+ document.body.innerHTML = ''+})+afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }) })++describe('a cardio exercise logged as sets x reps (#678)', () => {+ it('jumping jack is cardio in the catalogue and opens on Cardio, with Reps and Time on offer', () => {+ expect(EXIDX[JUMPING_JACK].bp).toBe('cardio')+ const v = open(EXIDX[JUMPING_JACK], { sets: 1, min: 20, speed: 8 })+ expect(v.modes()).toEqual(['Cardio', 'Reps', 'Time'])+ expect(v.picked()).toBe('Cardio')+ expect(v.labels()).toContain('Intervals')+ })++ it('Reps gives it sets x reps, saved as a reps slot the session reads as reps', () => {+ const v = open(EXIDX[JUMPING_JACK], { sets: 1, min: 20, speed: 8 })+ v.pick('Reps')+ expect(v.labels()).toEqual(expect.arrayContaining(['Sets', 'Reps']))+ expect(v.labels()).not.toContain('Intervals')+ v.save()+ const saved = v.onSave.mock.calls[0][0]+ // Three sets, not the one interval it came from.+ expect(saved).toMatchObject({ mode: 'reps', sets: 3, reps: 10 })+ expect(saved).not.toHaveProperty('min')+ expect(modeOf({ ...saved, id: JUMPING_JACK })).toBe('reps')+ })++ it('reopens on Reps, and going back to Cardio saves an interval again', () => {+ const v = open(EXIDX[JUMPING_JACK], { sets: 3, reps: 20, weight: 0, mode: 'reps', bodyweight: true })+ expect(v.picked()).toBe('Reps')+ v.pick('Cardio')+ expect(v.labels()).toContain('Intervals')+ v.save()+ const saved = v.onSave.mock.calls[0][0]+ expect(saved).toMatchObject({ sets: 1, min: 20, speed: 8 })+ expect(modeOf({ ...saved, id: JUMPING_JACK })).toBe('cardio')+ })++ it('a strength exercise still only offers Reps and Time', () => {+ const bench = EXDB.find(e => e.bp === 'chest' && e.eq === 'barbell')+ const v = open(bench)+ expect(v.modes()).toEqual(['Reps', 'Time'])+ })+})diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex bf9261397..2d9f5f006 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -1752,7 +1752,9 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i// No warm-up rest of its own: the profile's (Settings > Workout) when it has one, else the work rest.const warmAll = typeof st.warmupRestSec === 'number' ? st.warmupRestSec : nullconst warmLikeAll = warmAll === null ? t('Like the work sets') : t('Default ({0})', warmAll > 0 ? fmtRest(warmAll) : t('No timer'))- const cardio = isCardio(ex.id)+ // A catalogue cardio exercise logs intervals by default, but it can be counted in sets x reps+ // or timed like any other (#678): jumping jacks and burpees are cardio and reps both.+ const cardioEx = isCardio(ex.id)const speedUnit = speedUnitOf(st)const seed = existing || initial || defaultConfig(ex.id)const [c, setC] = useState(() => {@@ -1766,7 +1768,10 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i})// Cardio keeps its own duration+speed form; the reps/time choice (issue #16) is offered for// everything else, which is where the gap was — planks, hangs, wall sits, loaded carries.- const mode = cardio ? 'cardio' : modeOf({ ...c, id: ex.id })+ // A cardio exercise gets Cardio as a third choice, and a slot that picked Reps or Time says so+ // in its `mode` (modeOf reads it before the body part).+ const mode = modeOf({ ...c, id: ex.id })+ const cardio = cardioEx && mode === 'cardio'// Both default from the dataset and are then whatever the config says — see isBw.const bw = !cardio && isBw({ ...c, id: ex.id })const perSide = isPerSide(c)@@ -1781,7 +1786,11 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, iconst triple = mode === 'reps' && activePolicy === 'triple'// Keep whatever the other mode already had (sets, weight) and fill only what is missing.const setMode = m => setC(x => {- const next = { ...defaultConfig(ex.id, m), ...x, mode: m }+ // Intervals and sets count different things: crossing into or out of cardio starts from the+ // new mode's own count instead of 1 set of 10 jumping jacks.+ const { sets: _sets, ...rest } = x+ const crossing = (m === 'cardio') !== (modeOf({ ...x, id: ex.id }) === 'cardio')+ const next = { ...defaultConfig(ex.id, m), ...(crossing ? rest : x), mode: m }return m === 'reps' && climbsRange(policyFor({ ...next, id: ex.id }, routine, 'reps'))? { ...next, ...normalizeRepRange(next.reps, next.repsMin, isPerSide(next) ? 2 : 1) }: next@@ -1892,10 +1901,10 @@ function ExConfig({ ex, existing, onSave, onDelete, onReplace, close, routine, i.map((s, i) => <span key={i} className="tag dim">{t(MUSCLE_NAME[s] || s)}</span>)}</div>{descFor(ex) && <div className="exnote">{descFor(ex)}</div>}- {!cardio && <div style={{ marginBottom: 14 }}>+ <div style={{ marginBottom: 14 }}><Segmented className="seg-range" value={mode} onChange={setMode}- options={[{ value: 'reps', label: t('Reps') }, { value: 'time', label: t('Time') }]} />- </div>}+ options={[...(cardioEx ? [{ value: 'cardio', label: t('Cardio') }] : []), { value: 'reps', label: t('Reps') }, { value: 'time', label: t('Time') }]} />+ </div><div className="row cfgrow" style={{ marginBottom: mode === 'time' ? 8 : 18 }}>{cardio ? <><Stepper label={t('Intervals')} value={c.sets} step={1} decimal={false} onChange={v => setC(x => ({ ...x, sets: v }))} />