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.

Workout: the header ⋮ has Don't count for progression for the whole workout, so an injury day stays out of the next session's numbers; every exercise shows the marker, a second tap counts them again, an exercise or routine added afterwards stays out too, and it works in the saved-workout editor (Discord asierlama, #203)

Duarte Santos7d7cbb83e01f
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 3d7b9cf0f..882d15348 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -41,7 +41,7 @@ describe('Brazilian Portuguese locale', () => {
// has to be taught is a number nobody reads. What the numbers stood for is asserted above.
// If the hash fails, review the changed keys and wording before accepting a new one. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('1a6ecca227bbbead13b5be3e4e410f1e1c9ac36bd32d31199bfd1581d792f4ef')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('de3c7a1850341bf238bd4f9544a30e5a2e043e232f8acbce0582cd527d96b429')
})
test('does not leak European Portuguese UI terms', () => {
diff --git a/frontend/src/lib/session-edit.js b/frontend/src/lib/session-edit.js
index 5c82f2f82..0e6e67ca4 100644
--- a/frontend/src/lib/session-edit.js
+++ b/frontend/src/lib/session-edit.js
@@ -75,9 +75,12 @@ export function editCompletedSession(state, ref) {
// A workout saved before exclusion moved onto the entries (ENG-11) carries only the whole-workout
// flag. The editor rebuilds that flag from the entries (buildCompletedWorkout), so it is written
// onto each of them here, the way a session starts since: the edited workout stays out of
- // progression, and a swap in the editor keeps its replacement out too.
+ // progression, and a swap in the editor keeps its replacement out too. A workout out as a whole
+ // opens with the header's "Don't count for progression" on (lib/session-noprog.js), so it can
+ // be switched off there, and an exercise added in the editor stays out with the rest.
if (original.excludeFromProgression === true) {
for (const entry of list(active.entries)) if (entry && entry.noProg !== true) entry.noProg = true
+ active.noProg = true
}
// Worked out again on Save, from the edited sets.
for (const k of ['vol', 'prs', '_ts']) delete active[k]
diff --git a/frontend/src/lib/session-edit.test.js b/frontend/src/lib/session-edit.test.js
index d57356be5..2a853b488 100644
--- a/frontend/src/lib/session-edit.test.js
+++ b/frontend/src/lib/session-edit.test.js
@@ -187,6 +187,20 @@ describe('saved workout editing', () => {
expect(lastEntryFor(state, '0025').sets[0].w).toBe(80)
})
+ // The header ⋮'s "Don't count for progression" for the whole workout (lib/session-noprog.js)
+ // opens on for a workout saved out as a whole, and off for one that counts.
+ it('opens a workout kept out as a whole with the whole-workout switch on, and a counting one with it off', () => {
+ const state = fixture()
+ state.workouts.push({ id: 'rehab', d: '2026-09-02', start: 3000, end: 4000, excludeFromProgression: true, entries: [{ ...entry(10), noProg: true }], prs: [] })
+ editCompletedSession(state, 'rehab')
+ expect(state.active.noProg).toBe(true)
+ const saved = saveWorkoutEdit(state)
+ expect(saved).not.toHaveProperty('noProg')
+
+ editCompletedSession(state, 'workout')
+ expect(state.active).not.toHaveProperty('noProg')
+ })
+
// A stamp outranks what another device wrote since. Opening the editor and saving without a
// change must not give the record one, or it beats sets added on the phone that have not synced.
it('leaves the record and its stamp alone when Save changed nothing', () => {
diff --git a/frontend/src/lib/session-noprog.js b/frontend/src/lib/session-noprog.js
new file mode 100644
index 000000000..e0c1ea3ef
--- /dev/null
+++ b/frontend/src/lib/session-noprog.js
@@ -0,0 +1,53 @@
+// "Don't count for progression" for a whole session, from the workout header ⋮ (Discord,
+// asierlama: "exclude the current workout" on an injury day). An exercise's ⋯ menu does it for
+// one exercise by stamping that entry's `noProg`; this stamps every entry. The entries are what
+// everything downstream reads: the saved workout keeps each entry's flag and gets the whole-workout
+// `excludeFromProgression` when every entry carries it (finish-workout.js), and the history and the
+// next prescription read past them (history.js entryExcluded). So a session kept out as a whole
+// saves exactly like one whose exercises were each kept out by hand.
+//
+// `active.noProg` records that the choice was made for the session as a whole, which the entries
+// cannot tell on their own: a one-exercise session with that exercise kept out by hand looks the
+// same. It is what the header shows as on, and what an exercise or a routine added afterwards
+// joins, so the session stays out as a whole. It lives on the running session only; the saved
+// workout is built from the entries (buildCompletedWorkout lists its fields) and never carries it.
+
+const list = v => (Array.isArray(v) ? v : [])
+
+export const sessionNoProg = active => active?.noProg === true
+
+/**
+ * Keeps the whole session out of progression, or puts it back. Off counts every entry again
+ * except the ones a deload or rehab routine keeps out (`routineOwns(entry)`): that is the
+ * routine's setting, which its entries show with no switch of their own, the same rule as the
+ * exercise menu. Mutates `active`, for use inside a store update.
+ */
+export function setSessionNoProg(active, on, routineOwns = () => false) {
+ if (!active) return
+ if (on) {
+ active.noProg = true
+ for (const entry of list(active.entries)) if (entry) entry.noProg = true
+ return
+ }
+ delete active.noProg
+ for (const entry of list(active.entries)) if (entry && !routineOwns(entry)) delete entry.noProg
+}
+
+/**
+ * One exercise kept out or counted again from its own menu or its marker's Undo. Counting one
+ * again means the session is no longer out as a whole, so the header stops saying it is and an
+ * exercise added later counts too.
+ */
+export function setEntryNoProg(active, index, on) {
+ const entry = list(active?.entries)[index]
+ if (!entry) return
+ if (on) {
+ entry.noProg = true
+ return
+ }
+ delete entry.noProg
+ delete active.noProg
+}
+
+/** An entry joining the session (added, or brought in with a routine): out too while the whole session is. */
+export const joinSessionNoProg = (active, entry) => (sessionNoProg(active) ? { ...entry, noProg: true } : entry)
diff --git a/frontend/src/lib/session-noprog.test.js b/frontend/src/lib/session-noprog.test.js
new file mode 100644
index 000000000..5d876deb2
--- /dev/null
+++ b/frontend/src/lib/session-noprog.test.js
@@ -0,0 +1,99 @@
+import { describe, expect, it } from 'vitest'
+import { sessionNoProg, setSessionNoProg, setEntryNoProg, joinSessionNoProg } from './session-noprog.js'
+import { buildCompletedWorkout } from './finish-workout.js'
+import { entryExcluded, lastEntryFor } from './history.js'
+
+// "Don't count for progression" for the whole workout (Discord, asierlama: an injury day).
+const entry = (id, extra = {}) => ({ id, target: { sets: 1, reps: 5, weight: 60 }, sets: [{ w: 60, r: 5, done: true }], ...extra })
+const session = entries => ({ id: 'a', d: '2026-09-24', start: 0, routineIds: ['main'], name: 'Main', entries })
+const deloadOwns = e => e.rid === 'deload'
+
+describe('setSessionNoProg', () => {
+ it('on: every entry is kept out and the session says it is out as a whole', () => {
+ const active = session([entry('0025'), entry('0027', { noProg: true })])
+ setSessionNoProg(active, true)
+ expect(sessionNoProg(active)).toBe(true)
+ expect(active.entries.map(e => e.noProg)).toEqual([true, true])
+ })
+
+ it('off: every entry counts again, apart from the ones a deload routine keeps out', () => {
+ const active = session([entry('0025', { rid: 'main' }), entry('0027', { rid: 'deload', noProg: true })])
+ setSessionNoProg(active, true, deloadOwns)
+ setSessionNoProg(active, false, deloadOwns)
+ expect(sessionNoProg(active)).toBe(false)
+ expect('noProg' in active).toBe(false)
+ expect(active.entries.map(e => e.noProg)).toEqual([undefined, true])
+ })
+
+ it('does nothing without a session', () => {
+ expect(() => setSessionNoProg(null, true)).not.toThrow()
+ expect(sessionNoProg(null)).toBe(false)
+ })
+})
+
+describe('setEntryNoProg', () => {
+ it('keeps one exercise out without making it the whole session', () => {
+ const active = session([entry('0025')])
+ setEntryNoProg(active, 0, true)
+ expect(active.entries[0].noProg).toBe(true)
+ expect(sessionNoProg(active)).toBe(false)
+ })
+
+ it('counting one exercise again ends the whole-session choice, the others stay out', () => {
+ const active = session([entry('0025'), entry('0027')])
+ setSessionNoProg(active, true)
+ setEntryNoProg(active, 1, false)
+ expect(sessionNoProg(active)).toBe(false)
+ expect(active.entries.map(e => e.noProg)).toEqual([true, undefined])
+ })
+
+ it('ignores an index with no entry', () => {
+ const active = session([entry('0025')])
+ setSessionNoProg(active, true)
+ setEntryNoProg(active, 5, false)
+ expect(sessionNoProg(active)).toBe(true)
+ })
+})
+
+describe('joinSessionNoProg', () => {
+ it('an entry added to a session kept out as a whole is kept out too', () => {
+ const active = session([entry('0025')])
+ setSessionNoProg(active, true)
+ expect(joinSessionNoProg(active, entry('0043')).noProg).toBe(true)
+ })
+
+ it('an exercise kept out by hand is not passed on to one added after it', () => {
+ const active = session([entry('0025')])
+ setEntryNoProg(active, 0, true)
+ const added = entry('0043')
+ expect(joinSessionNoProg(active, added)).toBe(added)
+ expect(added.noProg).toBeUndefined()
+ })
+})
+
+// The saved workout is built from the entries, so it reads exactly like one whose exercises were
+// each kept out by hand: the whole-workout mirror, every entry excluded, no session-only field.
+describe('a session kept out as a whole, saved', () => {
+ it('writes excludeFromProgression and noProg on every entry, and the history reads past it', () => {
+ const active = session([entry('0025', { rid: 'main' }), entry('0027', { rid: 'main' })])
+ setSessionNoProg(active, true)
+ active.entries.push(joinSessionNoProg(active, entry('0043', { rid: 'main' })))
+ const saved = buildCompletedWorkout(active, { end: 1 })
+ expect(saved.excludeFromProgression).toBe(true)
+ expect(saved.entries.every(e => e.noProg === true && entryExcluded(saved, e))).toBe(true)
+ expect(saved).not.toHaveProperty('noProg')
+
+ const earlier = { id: 'w0', d: '2026-09-20', routineIds: ['main'], entries: [entry('0025', { rid: 'main', sets: [{ w: 100, r: 5, done: true }] })] }
+ const S = { workouts: [earlier, saved], routines: [], exWeights: {} }
+ expect(lastEntryFor(S, '0025', 'main').d).toBe('2026-09-20')
+ })
+
+ it('switched off again before the finish, it saves as an ordinary counting workout', () => {
+ const active = session([entry('0025'), entry('0027')])
+ setSessionNoProg(active, true)
+ setSessionNoProg(active, false)
+ const saved = buildCompletedWorkout(active, { end: 1 })
+ expect(saved).not.toHaveProperty('excludeFromProgression')
+ expect(saved.entries.some(e => 'noProg' in e)).toBe(false)
+ })
+})
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index dac9b3762..7c46eb5aa 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -1597,4 +1597,5 @@ export default {
'You get a code that lets your phone or another computer create a passkey for this profile. First confirm that it is you.': 'ستحصل على رمز يتيح لهاتفك أو لحاسوب آخر إنشاء مفتاح مرور لهذا الملف الشخصي. أكّد أولًا أنك أنت.',
'or with your password': 'أو بكلمة المرور',
'{0} passkeys': 'مفاتيح المرور: {0}',
+ 'Every exercise in this workout': 'كل التمارين في هذه الجلسة',
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 4a908b80a..e6996f3da 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -1564,4 +1564,5 @@ export default {
'Log your body weight to score this lift.': 'Trag dein Körpergewicht ein, damit diese Übung bewertet werden kann.',
'Log the anchor lift to score this one.': 'Trag die Anker-Übung ein, damit diese bewertet werden kann.',
'Not scored': 'Nicht bewertet',
+ 'Every exercise in this workout': 'Alle Übungen dieses Trainings',
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 1950c5525..db8ac5d00 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': 'Registra tu peso corporal para evaluar este ejercicio.',
'Log the anchor lift to score this one.': 'Registra el ejercicio ancla para evaluar este.',
'Not scored': 'Sin evaluar',
+ 'Every exercise in this workout': 'Todos los ejercicios de este entrenamiento',
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index 378e8580d..5422b2be7 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': 'Note ton poids corporel pour évaluer cet exercice.',
'Log the anchor lift to score this one.': 'Note l’exercice de référence pour évaluer celui-ci.',
'Not scored': 'Non évalué',
+ 'Every exercise in this workout': 'Tous les exercices de cette séance',
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index b5da08470..ac082b97e 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': 'इस व्यायाम का आकलन करने के लिए अपने शरीर का वज़न दर्ज करें।',
'Log the anchor lift to score this one.': 'इसका आकलन करने के लिए आधार व्यायाम दर्ज करें।',
'Not scored': 'आकलन नहीं हुआ',
+ 'Every exercise in this workout': 'इस वर्कआउट के सभी व्यायाम',
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 73f877747..8e0f03b9f 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -1547,4 +1547,5 @@ export default {
'Log your body weight to score this lift.': 'Rögzítsd a testsúlyodat, hogy ez a gyakorlat értékelhető legyen.',
'Log the anchor lift to score this one.': 'Rögzítsd a viszonyítási alapul szolgáló gyakorlatot, hogy ez is értékelhető legyen.',
'Not scored': 'Nincs értékelve',
+ 'Every exercise in this workout': 'Az edzés összes gyakorlata',
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index a5c176744..91a986f46 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': 'Registra il tuo peso corporeo per valutare questo esercizio.',
'Log the anchor lift to score this one.': 'Registra l’esercizio di riferimento per valutare questo.',
'Not scored': 'Non valutato',
+ 'Every exercise in this workout': 'Tutti gli esercizi di questo allenamento',
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 52c622640..6e9120a19 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': '이 운동을 평가하려면 체중을 기록하세요.',
'Log the anchor lift to score this one.': '이 운동을 평가하려면 기준 운동을 기록하세요.',
'Not scored': '평가 안 됨',
+ 'Every exercise in this workout': '이번 세션의 모든 운동',
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index e32cdcb6d..66abbcea1 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': 'Zapisz swoją masę ciała, aby ocenić to ćwiczenie.',
'Log the anchor lift to score this one.': 'Zapisz ćwiczenie będące punktem odniesienia, aby ocenić to ćwiczenie.',
'Not scored': 'Bez oceny',
+ 'Every exercise in this workout': 'Wszystkie ćwiczenia w tym treningu',
}
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index a24c3d453..bcc9fd2ac 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': 'Regista o teu peso corporal para avaliar este exercício.',
'Log the anchor lift to score this one.': 'Regista o exercício de referência para avaliar este.',
'Not scored': 'Sem avaliação',
+ 'Every exercise in this workout': 'Todos os exercícios deste treino',
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 8509c6f6c..7ee4aeb3c 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': 'Запишите вес тела, чтобы оценить это упражнение.',
'Log the anchor lift to score this one.': 'Запишите опорное упражнение, чтобы оценить это.',
'Not scored': 'Не оценено',
+ 'Every exercise in this workout': 'Все упражнения этой тренировки',
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 113bc6195..643f5af47 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -1555,4 +1555,5 @@ export default {
'Log your body weight to score this lift.': 'บันทึกน้ำหนักตัวเพื่อประเมินท่านี้',
'Log the anchor lift to score this one.': 'บันทึกท่าอ้างอิงเพื่อประเมินท่านี้',
'Not scored': 'ยังไม่ได้ประเมิน',
+ 'Every exercise in this workout': 'ทุกท่าในการออกกำลังกายครั้งนี้',
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 3551af1cb..fb8d2e8fb 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': 'Bu hareketin değerlendirilmesi için vücut ağırlığını kaydet.',
'Log the anchor lift to score this one.': 'Bunu değerlendirmek için referans hareketi kaydet.',
'Not scored': 'Değerlendirilmedi',
+ 'Every exercise in this workout': 'Bu antrenmandaki tüm egzersizler',
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 2b7ae36d2..d8eb9b229 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -1541,4 +1541,5 @@ export default {
'You get a code that lets your phone or another computer create a passkey for this profile. First confirm that it is you.': 'Ти отримаєш код, з яким твій телефон чи інший комп’ютер зможе створити ключ доступу для цього профілю. Спершу підтверди, що це ти.',
'or with your password': 'або своїм паролем',
'{0} passkeys': 'Ключів доступу: {0}',
+ 'Every exercise in this workout': 'Усі вправи цього тренування',
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index e3e097d6d..79e653055 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -1544,4 +1544,5 @@ export default {
'Log your body weight to score this lift.': '记录你的体重以评估这个动作。',
'Log the anchor lift to score this one.': '记录锚点动作以评估这个动作。',
'Not scored': '未评估',
+ 'Every exercise in this workout': '本次训练的所有动作',
}
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index bf284b595..39a852e37 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -38,6 +38,7 @@ import { swapActiveExercise } from './lib/active-exercise-swap.js'
import { useSheetKeyboard, useRevealActiveChip, tappable } from './lib/use-sheet-keyboard.js'
import { isFav, toggleFav, sortFavouritesFirst } from './lib/favourites.js'
import { buildSessionEntries, buildPlannedEntry, builtOutOfProgression } from './lib/session-start.js'
+import { joinSessionNoProg } from './lib/session-noprog.js'
import { buildCombinedEntries, deriveSessionName } from './lib/session-merge.js'
import { workoutsOn, backfillStart, backfillEnd, completeBackfill, historyAsOf, sessionHistory } from './lib/backfill.js'
import { moveWorkout, sameWorkout, startTimeOf, durationMinOf, setWorkoutDuration } from './lib/workout-date.js'
@@ -2236,7 +2237,9 @@ function AddRoutineToSession({ close }) {
const entries = buildSessionEntries(sessionHistory(st), r).map(e => ({ ...e, rid: r.id }))
update(s => {
if (!s.active) return
- s.active.entries.push(...entries)
+ // A session kept out of progression as a whole (the header ⋮) keeps the routine's
+ // exercises out too, the same as an exercise added on its own.
+ s.active.entries.push(...entries.map(e => joinSessionNoProg(s.active, e)))
s.active.routineIds = [...[].concat(s.active.routineIds || []), r.id]
if (!s.active.customName) {
s.active.name = deriveSessionName(s.active.routineIds.map(id => s.routines.find(x => x.id === id)?.name).filter(Boolean))
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 9510af694..d2a4392ee 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -22,6 +22,7 @@ import { Button, Check, NumberField } from '../components/ui.jsx'
import { defaultIncrement, weightIncrement, stepWeight } from '../lib/progression.js'
import { progressionGuidance } from '../lib/progression-copy.js'
import { buildPlannedEntry, plannedConfigOf, builtOutOfProgression } from '../lib/session-start.js'
+import { sessionNoProg, setSessionNoProg, setEntryNoProg, joinSessionNoProg } from '../lib/session-noprog.js'
import { glyphOf } from '../lib/glyphs.js'
import { markAllSetsDone, sessionHistory } from '../lib/backfill.js'
import { bestSetFor } from '../lib/exercise-history.js'
@@ -834,16 +835,18 @@ function ActiveWorkout() {
// workout keeps it (finish-workout.js), and the next prescription and "last time" read past
// this entry (history.js entryExcluded). This exercise, this session; the routine is untouched.
// Unlike a deload's, its rows keep the prescription through any rebuild (builtOutOfProgression),
- // so switching it off again leaves the numbers this session should count at.
- const setNoProg = (idx, on) => update(s => {
- const e = s.active?.entries?.[idx]
- if (!e) return
- if (on) e.noProg = true
- else delete e.noProg
- })
+ // so switching it off again leaves the numbers this session should count at. Counting one
+ // exercise again also ends "the whole workout" from the header ⋮ (lib/session-noprog.js).
+ const setNoProg = (idx, on) => update(s => setEntryNoProg(s.active, idx, on))
// A deload or rehab routine keeps its own exercises out (RoutineEdit). That is the routine's
// setting, so its entries get the marker but no switch.
const routineKeepsOut = e => !!e?.rid && S.routines.some(r => r.id === e.rid && r.excludeFromProgression === true)
+ // The same for the whole session from the header ⋮ (Discord, asierlama: "exclude the current
+ // workout" on an injury day): every exercise gets the marker, and one added later joins them.
+ // Absent when a deload or rehab routine already keeps every exercise out, since nothing is left
+ // for the switch to change. Off counts them all again, apart from those.
+ const noProgSwitchable = !A.entries.length || A.entries.some(e => !routineKeepsOut(e))
+ const toggleSessionNoProg = () => update(s => setSessionNoProg(s.active, !sessionNoProg(s.active), routineKeepsOut))
// One prop object per entry so the card and list layouts share the exact same wiring. The
// exercise-level actions (swap, move, remove) address the entry itself, so the "more" menu of
@@ -927,6 +930,7 @@ function ActiveWorkout() {
A.backfill && A.entries.length > 0 && { icon: 'checkCircle', label: t('Mark all sets done'), onClick: markAllDone },
{ icon: 'pencil', label: t('Rename workout'), onClick: renameWorkoutSheet },
!editing && { icon: 'plus', label: t('Add routine'), sub: t('Bring another routine into this session'), onClick: addRoutineToSessionSheet },
+ noProgSwitchable && { icon: 'pause', label: t('Don’t count for progression'), sub: t('Every exercise in this workout'), on: sessionNoProg(A), onClick: toggleSessionNoProg },
{ icon: 'list', label: t('Layout'), sub: LAYOUT_LABEL[workoutView] || LAYOUT_LABEL.cards, onClick: openLayoutMenu },
],
})
@@ -1350,7 +1354,8 @@ function ActiveWorkout() {
// 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. An exercise kept out by
- // hand (its ⋯ menu) is that exercise's own choice for today and is not passed on.
+ // hand (its ⋯ menu) is that exercise's own choice for today and is not passed on; a session
+ // kept out as a whole (the header ⋮) takes the new one with it (joinSessionNoProg).
const curEntry = A.entries[A.cur]
const curRid = curEntry?.rid
const routine = curRid ? S.routines.find(r => r.id === curRid) : null
@@ -1372,7 +1377,7 @@ function ActiveWorkout() {
}), full) }
: buildPlannedEntry(past, 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 } : {}), ...(noProg ? { noProg: true } : {}) })
+ s.active.entries.splice(insertAt, 0, joinSessionNoProg(s.active, { 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.noprog-session.test.jsx b/frontend/src/views/Workout.noprog-session.test.jsx
new file mode 100644
index 000000000..b5d0b556f
--- /dev/null
+++ b/frontend/src/views/Workout.noprog-session.test.jsx
@@ -0,0 +1,224 @@
+// @vitest-environment happy-dom
+// "Don't count for progression" for the whole workout, from the header ⋮ (Discord, asierlama:
+// "exclude the current workout" on an injury day), against the real store, sheets and editor:
+// every exercise gets the marker, it switches off again, what joins the session later follows it,
+// and the #203 editor opens, changes and saves it.
+import React, { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { MemoryRouter } from 'react-router-dom'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import Workout from './Workout.jsx'
+import { DEF, useStore } from '../store/useStore.js'
+import { useUI } from '../store/useUI.js'
+import { editCompletedSession } from '../lib/session-edit.js'
+import { lastEntryFor } from '../lib/history.js'
+import { EXDB } from '../lib/exercises.js'
+
+vi.mock('../lib/sound.js', () => ({ beep: vi.fn(), chime: vi.fn(), vibrate: vi.fn(), unlock: vi.fn() }))
+vi.mock('../lib/api.js', () => ({ api: vi.fn(() => Promise.resolve({})), appBase: () => '/' }))
+
+globalThis.IS_REACT_ACT_ENVIRONMENT = true
+const clone = value => JSON.parse(JSON.stringify(value))
+const BENCH = '0025'
+const ROW = '0027'
+const SQUAT = '0043'
+const routines = [
+ { id: 'main', name: 'Main', ex: [{ id: BENCH, sets: 1, reps: 5, weight: 100 }, { id: ROW, sets: 1, reps: 8, weight: 60 }] },
+ { id: 'legs', name: 'Legs', ex: [{ id: SQUAT, sets: 1, reps: 5, weight: 80 }] },
+ { id: 'deload', name: 'Deload', excludeFromProgression: true, ex: [{ id: ROW, sets: 1, reps: 8, weight: 40 }] },
+]
+const entry = (id, rid, w, extra = {}) => ({ id, rid, target: { sets: 1, reps: 5, weight: w }, sets: [{ w, r: 5, done: false }], ...extra })
+const HEADER_SUB = 'Every exercise in this workout'
+
+let root
+let container
+let sheetRoot
+let sheetContainer
+
+function mount(S) {
+ useStore.setState({ S, user: null })
+ container = document.createElement('div')
+ document.body.appendChild(container)
+ root = createRoot(container)
+ act(() => root.render(<MemoryRouter><Workout /></MemoryRouter>))
+}
+function renderWorkout(entries, { workouts = [] } = {}) {
+ const S = clone(DEF)
+ S.routines = clone(routines)
+ S.workouts = clone(workouts)
+ // List view: every exercise's card is on screen at once.
+ S.active = { id: 'session', d: '2026-09-24', start: Date.now(), routineIds: ['main'], routineId: 'main', name: 'Main', bw: null, cur: 0, workoutView: 'list', entries }
+ mount(S)
+}
+function renderEditor(saved) {
+ const S = clone(DEF)
+ S.routines = clone(routines)
+ S.workouts = [clone(saved)]
+ S.workoutView = 'list'
+ editCompletedSession(S, saved.id)
+ mount(S)
+}
+
+function renderTopSheet() {
+ if (sheetRoot) act(() => sheetRoot.unmount())
+ if (sheetContainer) sheetContainer.remove()
+ const sheet = useUI.getState().sheets.at(-1)
+ expect(sheet).toBeTruthy()
+ sheetContainer = document.createElement('div')
+ document.body.appendChild(sheetContainer)
+ sheetRoot = createRoot(sheetContainer)
+ act(() => sheetRoot.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))
+ return sheetContainer
+}
+const openHeaderMenu = () => {
+ const more = container.querySelector('button[aria-label="Workout view"]')
+ expect(more).toBeTruthy()
+ act(() => more.click())
+ return renderTopSheet()
+}
+const headerItem = () => [...openHeaderMenu().querySelectorAll('.menu-item')]
+ .find(it => it.querySelector('.tt')?.textContent === 'Don’t count for progression' && it.querySelector('.ss')?.textContent === HEADER_SUB)
+// Opened outside act(): the menu is rendered by nested act() calls, which an outer one would
+// batch until it ends, so the item would not be there yet to tap.
+const tapHeaderItem = () => {
+ const item = headerItem()
+ expect(item).toBeTruthy()
+ act(() => item.click())
+}
+const isOn = item => !!item.querySelector('.menu-on.is-on')
+const markers = () => [...container.querySelectorAll('.noprog')]
+const active = () => useStore.getState().S.active
+
+beforeEach(() => {
+ vi.useFakeTimers()
+ localStorage.clear()
+ useUI.setState({ sheets: [], toastMsg: '', timer: null, work: null })
+ root = null; container = null; sheetRoot = null; sheetContainer = null
+})
+
+afterEach(() => {
+ if (sheetRoot) act(() => sheetRoot.unmount())
+ if (sheetContainer) sheetContainer.remove()
+ if (root) act(() => root.unmount())
+ if (container) container.remove()
+ useUI.getState().stopRest()
+ vi.clearAllTimers()
+ vi.useRealTimers()
+})
+
+describe('don’t count the whole workout for progression', () => {
+ it('the header ⋮ keeps every exercise out, each card shows the marker, and a second tap counts them again', () => {
+ renderWorkout([entry(BENCH, 'main', 100), entry(ROW, 'main', 60)])
+ const item = headerItem()
+ expect(item).toBeTruthy()
+ expect(isOn(item)).toBe(false)
+ act(() => item.click())
+
+ expect(active().noProg).toBe(true)
+ expect(active().entries.map(e => e.noProg)).toEqual([true, true])
+ expect(markers()).toHaveLength(2)
+ expect(markers().every(m => m.textContent.includes('Not counted for progression'))).toBe(true)
+ // The routine is not touched.
+ expect(useStore.getState().S.routines.find(r => r.id === 'main').excludeFromProgression).toBeUndefined()
+
+ const again = headerItem()
+ expect(isOn(again)).toBe(true)
+ act(() => again.click())
+ expect(active().noProg).toBeUndefined()
+ expect(active().entries.map(e => e.noProg)).toEqual([undefined, undefined])
+ expect(markers()).toHaveLength(0)
+ })
+
+ it('switched off, an exercise a deload routine keeps out stays out', () => {
+ renderWorkout([entry(BENCH, 'main', 100), entry(ROW, 'deload', 40, { noProg: true })])
+ tapHeaderItem()
+ tapHeaderItem()
+ expect(active().entries.map(e => e.noProg)).toEqual([undefined, true])
+ })
+
+ it('is not offered when a deload routine already keeps every exercise out', () => {
+ renderWorkout([entry(ROW, 'deload', 40, { noProg: true })])
+ expect(headerItem()).toBeUndefined()
+ })
+
+ it('one card’s Undo counts that exercise again and the header no longer says the whole workout', () => {
+ renderWorkout([entry(BENCH, 'main', 100), entry(ROW, 'main', 60)])
+ tapHeaderItem()
+ const undo = [...markers()[1].querySelectorAll('button')].find(b => b.textContent === 'Undo')
+ act(() => undo.click())
+ expect(active().entries.map(e => e.noProg)).toEqual([true, undefined])
+ expect(active().noProg).toBeUndefined()
+ expect(isOn(headerItem())).toBe(false)
+ })
+
+ it('an exercise added afterwards joins it', () => {
+ renderWorkout([entry(BENCH, 'main', 100)])
+ tapHeaderItem()
+ const add = [...container.querySelectorAll('button')].find(b => b.textContent.trim() === 'Add exercise')
+ act(() => add.click())
+ const picker = useUI.getState().sheets.at(-1)
+ act(() => picker.render(picker.close).props.onPick(EXDB.find(e => e.id === SQUAT), true))
+ expect(active().entries.map(e => [e.id, e.noProg])).toEqual([[BENCH, true], [SQUAT, true]])
+ })
+
+ it('a routine added afterwards joins it, with its own prescription kept', () => {
+ renderWorkout([entry(BENCH, 'main', 100)])
+ tapHeaderItem()
+ const addRoutine = [...openHeaderMenu().querySelectorAll('.menu-item')].find(it => it.querySelector('.tt')?.textContent === 'Add routine')
+ act(() => addRoutine.click())
+ const legs = [...renderTopSheet().querySelectorAll('.item')].find(it => it.textContent.includes('Legs'))
+ expect(legs).toBeTruthy()
+ act(() => legs.click())
+ const squat = active().entries.find(e => e.id === SQUAT)
+ expect(squat.noProg).toBe(true)
+ expect(squat.plan?.kind).not.toBe('off')
+ })
+
+ it('without it, an exercise kept out on its own is not passed on to one added after it', () => {
+ renderWorkout([entry(BENCH, 'main', 100, { noProg: true })])
+ expect(isOn(headerItem())).toBe(false)
+ const add = [...container.querySelectorAll('button')].find(b => b.textContent.trim() === 'Add exercise')
+ act(() => add.click())
+ const picker = useUI.getState().sheets.at(-1)
+ act(() => picker.render(picker.close).props.onPick(EXDB.find(e => e.id === SQUAT), true))
+ expect(active().entries.find(e => e.id === SQUAT).noProg).toBeUndefined()
+ })
+})
+
+// The #203 editor is the same screen on a copy of the saved workout.
+describe('the whole-workout switch in the saved-workout editor', () => {
+ const done = (id, w) => ({ id, rid: 'main', target: { sets: 1, reps: 5, weight: w }, sets: [{ w, r: 5, done: true }] })
+ const counting = { id: 'saved', d: '2026-09-22', start: 1000, end: 2000, routineIds: ['main'], name: 'Main', entries: [done(BENCH, 100), done(ROW, 60)] }
+ const excluded = { ...counting, excludeFromProgression: true, entries: counting.entries.map(e => ({ ...e, noProg: true })) }
+ const earlier = { id: 'earlier', d: '2026-09-20', start: 0, end: 1, routineIds: ['main'], name: 'Main', entries: [done(BENCH, 90)] }
+ const saveButton = () => container.querySelector('button[aria-label="Save changes"]')
+ const saved = () => useStore.getState().S.workouts.find(w => w.id === 'saved')
+
+ it('a workout kept out as a whole opens with the switch on; switched off and saved, it counts again', () => {
+ renderEditor(excluded)
+ expect(active().editingWorkoutId).toBe('saved')
+ expect(markers()).toHaveLength(2)
+ const item = headerItem()
+ expect(isOn(item)).toBe(true)
+ act(() => item.click())
+ act(() => saveButton().click())
+
+ expect(active()).toBeNull()
+ expect(saved()).not.toHaveProperty('excludeFromProgression')
+ expect(saved().entries.some(e => 'noProg' in e)).toBe(false)
+ expect(lastEntryFor(useStore.getState().S, BENCH, 'main').d).toBe('2026-09-22')
+ })
+
+ it('switched on in the editor and saved, the workout is kept out like one finished that way', () => {
+ renderEditor(counting)
+ act(() => useStore.getState().update(s => { s.workouts.push(clone(earlier)) }))
+ tapHeaderItem()
+ expect(markers()).toHaveLength(2)
+ act(() => saveButton().click())
+
+ expect(saved().excludeFromProgression).toBe(true)
+ expect(saved().entries.every(e => e.noProg === true)).toBe(true)
+ expect(saved()).not.toHaveProperty('noProg')
+ expect(lastEntryFor(useStore.getState().S, BENCH, 'main').d).toBe('2026-09-20')
+ })
+})
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index 4fbff8178..fe37731d0 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -1672,11 +1672,12 @@ describe('workout view header menu', () => {
return mocks.menuSheet.mock.calls.at(-1)[0]
}
- it('includes Rename workout and Add routine, then a Layout sheet with the three layouts marked current', async () => {
+ it('includes Rename workout, Add routine and the whole-workout progression switch, then a Layout sheet with the three layouts marked current', async () => {
await mount([exercise('plain-bench', [false])], 0, { active: { workoutView: 'list', routineIds: [] } })
const menu = await openMenu()
- expect(menu.items.filter(Boolean).map(it => it.label)).toEqual(['Rename workout', 'Add routine', 'Layout'])
+ expect(menu.items.filter(Boolean).map(it => it.label)).toEqual(['Rename workout', 'Add routine', 'Don’t count for progression', 'Layout'])
+ expect(item(menu, 'Don’t count for progression')).toMatchObject({ sub: 'Every exercise in this workout', on: false })
expect(item(menu, 'Layout').sub).toBe('List')
await act(async () => { item(menu, 'Rename workout').onClick() })