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
curated2: !34
Duarte Santosadc655ebd3c5
diff --cc frontend/src/lib/plan-share.test.jsindex 36619e866,51d0b921f..7fc7075cd--- a/frontend/src/lib/plan-share.test.js+++ b/frontend/src/lib/plan-share.test.js@@@ -24,17 -24,26 +24,37 @@@ describe('what survives a shared plan'expect(roundTrip({ warmupSets: 3 }).warmupSets).toBe(3)})+ it('carries progression exclusion on a routine through export and merge', () => {+ const source = stateWith({})+ source.routines[0].excludeFromProgression = true+ const bundle = parsePlan(buildPlanBundle(source, 'Plan'))+ const target = { routines: [], week: {}, customEx: [] }++ expect(bundle.routines[0].excludeFromProgression).toBe(true)+ mergePlan(target, bundle)+ expect(target.routines[0].excludeFromProgression).toBe(true)+ })++ // Issue #10: the rest an exercise prescribes is part of the prescription. A shared 5x5 whose+ // rests arrive as the recipient's 60 s default is a different session than the one written.+ it('carries a per-exercise rest', () => {+ expect(roundTrip({ restSec: 180 }).restSec).toBe(180)+ })++ // The absence has to survive too: writing a 0 would pin the recipient's timer to "off"+ // instead of letting the exercise keep inheriting whatever their own default is.+ it('leaves an exercise that set no rest free of the field', () => {+ expect('restSec' in roundTrip({})).toBe(false)+ expect('restSec' in roundTrip({ restSec: 0 })).toBe(false)+ })++ it('carries the rest onto the routine mergePlan adds', () => {+ const bundle = parsePlan(JSON.stringify(buildPlanBundle(stateWith({ restSec: 180 }), 'Plan')))+ const s = { routines: [], customEx: [], week: {} }+ mergePlan(s, bundle, { schedule: false })+ expect(s.routines[0].ex[0].restSec).toBe(180)+ })+it('drops an intensifier it does not recognise rather than passing it on', () => {expect(roundTrip({ intensifier: { type: 'nonsense', count: 3 } }).intensifier).toBeUndefined()})diff --cc frontend/src/lib/supersetFlow.test.jsindex 39ba4bef7,272960fc5..74e6ea8fd--- a/frontend/src/lib/supersetFlow.test.js+++ b/frontend/src/lib/supersetFlow.test.js@@@ -1,5 -1,5 +1,5 @@@import { describe, expect, it } from 'vitest'- import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from './supersetFlow.js'-import { setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor } from './supersetFlow.js'++import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor } from './supersetFlow.js'const entry = done => ({ sets: done.map(value => ({ done: value })) })diff --cc frontend/src/views/Workout.jsxindex 25be741e6,33263ed88..43851591a--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@@ -8,9 -8,9 +8,9 @@@ import { fmtNum, fmtDate, todayISO, exCimport { beep, vibrate } from '../lib/sound.js'import { t, exerciseNameFor } from '../lib/i18n.js'import { api } from '../lib/api.js'- import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from '../lib/supersetFlow.js'-import { setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor } from '../lib/supersetFlow.js'++import { insertionIndexAfterCurrentUnit, nextUnfinishedUnit, setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck, restSecFor } from '../lib/supersetFlow.js'import Media from '../components/Media.jsx'-import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet } from '../sheets.jsx'+import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet, swapActiveWorkoutExercise } from '../sheets.jsx'import Icon from '../components/Icon.jsx'import { Button, Check, NumberField } from '../components/ui.jsx'import { nextPrescription, applyPrescription, defaultIncrement } from '../lib/progression.js'@@@ -529,41 -414,42 +529,45 @@@ function ActiveWorkout()const freshUnits = supersetUnits(fresh.entries)const freshUnit = freshUnits.find(u => u.includes(idx))- const freshUnitIdx = freshUnits.indexOf(freshUnit)- const freshLastUnit = freshUnitIdx >= freshUnits.length - 1const freshUnitDone = freshUnit?.every(ui => fresh.entries[ui].sets.every(x => x.done))+ const nextUnit = freshUnitDone ? nextUnfinishedUnit(fresh.entries, freshUnits, idx) : null+ const freshWorkoutDone = freshUnitDone && !nextUnit+ const restBeforeWarmup = nextUnit?.some(ui =>+ fresh.entries[ui].sets.some(set => isWarmupRow(set) && !set.done),+ )+ // The rest this set has earned: the exercise's own restSec when it set one, the global+ // timer when it did not, and the longest of the group's across a superset (issue #10).+ // Resolved once here so every branch below times the same break.+ const restSec = restSecFor(fresh.entries, freshUnit || [idx], S.restSec)// A re-check of finished work must not navigate or reopen a sheet, but it may still owe// you a rest — see restOnRecheck, and the other half of issue #3.if (!progress.isNew) {- if (!restBeforeWarmup && restOnRecheck({ timerRunning: !!useUI.getState().timer, unitDone: freshUnitDone, lastUnit: freshWorkoutDone })) startRest(S.restSec, idx)- if (restOnRecheck({ timerRunning: !!useUI.getState().timer, unitDone: freshUnitDone, lastUnit: freshLastUnit })) startRest(restSec)++ if (!restBeforeWarmup && restOnRecheck({ timerRunning: !!useUI.getState().timer, unitDone: freshUnitDone, lastUnit: freshWorkoutDone })) startRest(restSec, idx)return}// Singleton units are ordinary exercises: they rest between sets and after the closing- // one, and never enter superset navigation. stopRest() first so the rest that belongs- // after this set replaces the one that was running, rather than stacking on it.+ // one unless the next unit has an unfinished warm-up, and never enter superset navigation.+ // stopRest() first so a rest that belongs after this set replaces the one that was running.if (freshUnitDone) stopRest()if (!freshUnit || freshUnit.length <= 1) {- if (restAfterSet({ unitDone: freshUnitDone, lastUnit: freshLastUnit })) startRest(restSec)+ if (freshUnitDone && !askTop && nextUnit?.length) update(s => { if (s.active) s.active.cur = nextUnit[0] })- if (!restBeforeWarmup && restAfterSet({ unitDone: freshUnitDone, lastUnit: freshWorkoutDone })) startRest(S.restSec, idx)++ if (!restBeforeWarmup && restAfterSet({ unitDone: freshUnitDone, lastUnit: freshWorkoutDone })) startRest(restSec, idx)return}const step = supersetFlowStep(fresh.entries, freshUnit, idx)if (!step) returnif (step.unitDone) {- if (!freshLastUnit) {- const nextUnit = freshUnits[freshUnitIdx + 1]+ if (nextUnit?.length) {// The top-weight sheet's explicit "Just close" path owns the choice not to advance.- if (!askTop && nextUnit?.length) update(s => { if (s.active) s.active.cur = nextUnit[0] })- startRest(restSec)+ if (!askTop) update(s => { if (s.active) s.active.cur = nextUnit[0] })- if (!restBeforeWarmup) startRest(S.restSec, idx)++ if (!restBeforeWarmup) startRest(restSec, idx)}} else {if (step.nextIdx != null) update(s => { if (s.active) s.active.cur = step.nextIdx })- if (step.roundDone) startRest(S.restSec, idx)- if (step.roundDone) startRest(restSec)++ if (step.roundDone) startRest(restSec, idx)}}}