Skip to content

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.

An exercise added to or swapped into a rehab or deload block stays out of progression

Duarte Santos7c21bdc57227
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 6d4430975..90871a73a 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -1032,6 +1032,10 @@ export function swapActiveWorkoutExercise(index) {
id: ex.id,
...built,
...(current.rid ? { rid: current.rid } : {}),
+ // A slot kept out of progression stays out once swapped. Replaced in place the entry keeps
+ // it anyway; inserted beside logged sets, the replacement would otherwise count as a
+ // regular session of the new exercise.
+ ...(current.noProg === true ? { noProg: true } : {}),
}
const apply = options => {
diff --git a/frontend/src/sheets.swap.test.jsx b/frontend/src/sheets.swap.test.jsx
index bfa3cc740..f82c08813 100644
--- a/frontend/src/sheets.swap.test.jsx
+++ b/frontend/src/sheets.swap.test.jsx
@@ -66,6 +66,39 @@ describe('active exercise swap sheet flow', () => {
})
})
+// A slot of a routine kept out of progression (rehab, deload) stays out when it is swapped,
+// whether the replacement takes its place or, beside logged sets, goes in after it.
+describe('swapping an exercise kept out of progression', () => {
+ const install = done => {
+ const S = clone(DEF)
+ S.routines = [{ id: 'rehab', name: 'Rehab', excludeFromProgression: true, ex: [] }]
+ S.active = {
+ id: 'swap-noprog', d: '2026-08-27', start: Date.now(), routineIds: ['rehab'], name: 'Rehab', bw: null, cur: 0,
+ entries: [{ ...entry(ids[0], done), rid: 'rehab', noProg: true }],
+ }
+ useStore.setState({ S, user: null })
+ }
+
+ it('keeps it out when the replacement takes the slot', () => {
+ install(false)
+ submitSwap(0, EXDB[2], { mode: 'reps', sets: 1, reps: 12, weight: 10 })
+ const [swapped] = useStore.getState().S.active.entries
+ expect(swapped).toMatchObject({ id: ids[2], rid: 'rehab', noProg: true })
+ expect(swapped.plan.kind).toBe('off')
+ })
+
+ it('keeps it out when the replacement goes in after logged sets', () => {
+ install(true)
+ submitSwap(0, EXDB[2], { mode: 'reps', sets: 1, reps: 12, weight: 10 })
+ const confirm = useUI.getState().sheets.at(-1)
+ act(() => confirm.render(confirm.close).props.onConfirm())
+ const entries = useStore.getState().S.active.entries
+ expect(entries.map(e => e.id)).toEqual([ids[0], ids[2]])
+ expect(entries[1]).toMatchObject({ rid: 'rehab', noProg: true })
+ expect(entries[1].plan.kind).toBe('off')
+ })
+})
+
describe('active exercise swap locale coverage', () => {
const required = [
'Swap exercise',
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 794e2cbd6..b8a9c365c 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -1103,11 +1103,15 @@ function ActiveWorkout() {
<Button onClick={() => exercisePicker((ex, quick) => {
// A freehand add inherits the current unit's routine (its `rid`) so it lands in that
// routine's block in a combined session and gets a real prescription; a routine-less
- // freestyle session has no `rid` to inherit. `noProg` is never set independently here —
- // the only mid-session route to an excluded entry is "Add routine".
- const curRid = A.entries[A.cur]?.rid
+ // freestyle session has no `rid` to inherit. It inherits the block's `noProg` too: an
+ // exercise added to a rehab or deload routine's block is kept out of progression like the
+ // rest of it, the way a swap or an edit there is — it takes the routine's own numbers and
+ // never becomes the baseline the regular sessions progress from.
+ const curEntry = A.entries[A.cur]
+ const curRid = curEntry?.rid
const routine = curRid ? S.routines.find(r => r.id === curRid) : null
const freestyle = !routine
+ const noProg = !freestyle && curEntry?.noProg === true
// Freestyle has no routine prescription to apply: show the last target in the config
// sheet and carry its completed rows forward. A planned session uses its configured
// target when progression is off, while progression-enabled sessions keep their path.
@@ -1120,9 +1124,9 @@ function ActiveWorkout() {
? { target: { ...cfg }, plan: null, sets: applyIntensifierPlan(buildSets(s, full, {
step: modeOf(full) === 'reps' ? weightIncrement(full, s.unit) : defaultIncrement(ex.id, s.unit), preferLast: true,
}), full) }
- : buildPlannedEntry(s, full, routine)
+ : buildPlannedEntry(s, full, routine, { noProg })
const insertAt = insertionIndexAfterCurrentUnit(supersetUnits(s.active.entries), s.active.cur, s.active.entries.length)
- s.active.entries.splice(insertAt, 0, { id: ex.id, ...built, ...(curRid ? { rid: curRid } : {}) })
+ s.active.entries.splice(insertAt, 0, { id: ex.id, ...built, ...(curRid ? { rid: curRid } : {}), ...(noProg ? { noProg: true } : {}) })
s.active.cur = insertAt
useUI.getState().shiftRestOwner(insertAt, 1)
})
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index a9839c3e7..55a757a6f 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -504,6 +504,35 @@ describe('Workout add exercise flow', () => {
})
})
+// An exercise added to the block of a routine kept out of progression (a rehab or deload
+// routine) belongs to that block: its routine's own numbers, and no count toward progression.
+describe('adding an exercise to a block kept out of progression', () => {
+ const BENCH = '0025'
+ const history = [{
+ d: '2026-08-27', routineIds: ['main'],
+ entries: [{ id: BENCH, rid: 'main', target: { sets: 1, reps: 5, weight: 100 }, sets: [{ w: 100, r: 5, done: true }] }],
+ }]
+ const routines = [{ id: 'rehab', name: 'Rehab', excludeFromProgression: true, ex: [] }, { id: 'main', name: 'Main', ex: [] }]
+
+ it('is kept out too, at the numbers typed for it', async () => {
+ await mount([exercise('band-pull', [false], { rid: 'rehab', noProg: true })], 0, { routines, workouts: history })
+ await addExerciseThroughSheets({ id: BENCH }, { mode: 'reps', sets: 1, reps: 12, weight: 40 })
+ const added = mocks.S.active.entries[1]
+ expect(added).toMatchObject({ id: BENCH, rid: 'rehab', noProg: true })
+ expect(added.plan.kind).toBe('off')
+ expect(added.sets.map(s => [s.w, s.r])).toEqual([[40, 12]])
+ })
+
+ it('still progresses when the block is a regular routine\'s', async () => {
+ await mount([exercise('row', [false], { rid: 'main' })], 0, { routines, workouts: history })
+ await addExerciseThroughSheets({ id: BENCH }, { mode: 'reps', sets: 1, reps: 5, weight: 40 })
+ const added = mocks.S.active.entries[1]
+ expect(added.noProg).toBeUndefined()
+ expect(added.plan.kind).toBe('up')
+ expect(added.sets.map(s => s.w)).toEqual([102.5])
+ })
+})
+
describe('active workout weight controls', () => {
const press = async (label, selector) => {
const control = container.querySelector(selector)