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.

Add planned drop-sets and rest-pause/myo-reps intensifiers

Josevi02ea938b2ce1
diff --git a/PROJECT_CONTEXT.md b/PROJECT_CONTEXT.md
new file mode 100644
index 000000000..8f0e3612f
--- /dev/null
+++ b/PROJECT_CONTEXT.md
@@ -0,0 +1,188 @@
+# PROJECT_CONTEXT.md
+
+Notes for whoever picks this up next. Not a spec — a map of what changed and why, kept next to
+the code it describes. See `CLAUDE.md` for the general architecture; this file only covers the
+drop-set / rest-pause work.
+
+## What this adds
+
+Two new set "shapes" on top of the existing straight/warm-up model:
+
+- **Drop-set**: a main set followed by one or more weight drops, logged with no real rest.
+- **Rest-pause / myo-reps**: an activation set (a normal set near failure) followed by short
+ bursts of extra reps, each preceded by a brief rest.
+
+Both are **planned on the exercise**, in the same config sheet used by the routine editor and by
+"add exercise" mid-workout (`ExConfig` in `sheets.jsx`) — not decided live during the workout.
+Planning it stamps every set of that exercise and pre-fills the actual drop/burst rows with
+real, already-editable numbers the moment the session starts. A straight (unplanned) set can
+still grow a drop/burst live via "+ Drop"/"+ Burst" — that path never went away, it just isn't
+the primary one anymore.
+
+## The set row (`frontend/src/lib/workout-model.js`)
+
+There was never a `type` enum on a set row before this — only `phase` (`'work'` / `'warmup'`,
+with a legacy `warmup: true` boolean as fallback). This adds a **second, orthogonal**
+discriminator, `type`:
+
+```js
+phase: 'work' | 'warmup' // existing axis — prep or the real session?
+type: 'straight' | 'dropset' | 'restpause' // new axis — what shape is this row? (default 'straight')
+```
+
+A drop-set or rest-pause row is still exactly one entry in `entry.sets` — the extra work rides
+*inside* that row, the same trick `phase` already uses for warm-ups:
+
+```js
+// dropset — main set + extra drops ON TOP of it (extraVolumeOf adds the drops back in for totals)
+{ type: 'dropset', w: 100, r: 5, done: true, drops: [{ w: 80, r: 5 }, { w: 64, r: 5 }] }
+
+// restpause — the row's own r IS the total across every burst; clusters are a BREAKDOWN of that
+// same total, not extra on top of it (12 → [6, 3, 2, 1], and 6+3+2+1 == 12, always)
+{ type: 'restpause', w: 60, r: 12, done: true, clusters: [{ r: 6, restSec: 15 }, { r: 3, restSec: 15 }, { r: 2, restSec: 15 }, { r: 1, restSec: 15 }] }
+```
+
+Those two extras genuinely mean different things, which trips people up (it tripped this
+implementation up first): a drop-set's `drops` are *additional* work beyond the main set — the
+main set stays a real, separate effort. A rest-pause row's `clusters` are the *decomposition* of
+its own `r` — there is no separate "first burst is the real one" distinction, `r` already speaks
+for the whole thing. Getting this backwards is exactly the bug this file's earlier revision had:
+`r` held only the split's biggest chunk, so the row displayed a random-looking fraction of what
+was configured instead of the number that was actually typed in.
+
+Pure helpers in `workout-model.js`, mirroring the existing `phaseForSet`/`isWarmupRow` style:
+
+- `setType(set)`, `isDropSet(set)`, `isRestPauseSet(set)` — read the discriminator.
+- `dropsOf(set)` / `clustersOf(set)` — the extras array, or `[]` for anything else.
+- `extraVolumeOf(set)` — weight×reps across a drop-set's `drops`, on top of the row's own w×r.
+ **Zero for rest-pause** — see above, its `clusters` never add to this or they'd double-count.
+- `addDrop(set, drop)` / `addCluster(set, cluster)` — pure append, stamps `type`.
+- `removeDropAt(set, i)` / `removeClusterAt(set, i)` — pure remove by index; clearing the last
+ one reverts the row to `'straight'`.
+- `setDropAt(set, i, patch)` / `setClusterAt(set, i, patch)` — pure in-place edit (the weight/reps
+ steppers on an already-added drop/burst).
+- `nextDropWeight(prevWeight, pct)` — pct% lighter than `prevWeight`, rounded to the nearest .5.
+- `nextBurstReps(prevReps)` — roughly half of `prevReps`, floored at 1.
+- `splitBurstReps(total)` — splits a rest-pause **total** rep count into a descending,
+ roughly-halving sequence of bursts that sums back to it (`12 → [6, 3, 2, 1]`). This is what a
+ planned rest-pause exercise configures directly: you say how many total reps you want out of
+ the whole rest-pause portion, not how many separate rests.
+
+In `Workout.jsx`, `addBurstRow`/`removeCluster`/`setClusterField` all adjust the row's own `r` by
+the same delta as whatever they just did to `clusters`, so the invariant (`r` == sum of every
+`clustersOf` entry) survives live edits too, not just the initial plan — including the case of
+tapping "+ Burst" cold on a plain straight set, where the set's original reps become the seed a
+running total grows from rather than a separately-standing "main" effort. `addDrop`/`removeDrop`
+on a drop-set row do **not** do this — a drop-set's main set stays independent on purpose.
+
+## Planning (`ExConfig` in `sheets.jsx`) → `cfg.intensifier`
+
+The exercise config sheet (routine editor and mid-workout "add exercise" both use it) has an
+"Intensifier" picker: None / Drop-set / Rest-pause. Selecting one adds `intensifier` to the saved
+config:
+
+```js
+// drop-set: every configured set becomes a drop-set — N drops, each pct% lighter than the one before
+{ intensifier: { type: 'dropset', count: 2, pct: 20 } }
+
+// rest-pause: NOT applied per set. It replaces the exercise's whole set list with exactly two
+// rows regardless of the configured "Sets" (which the UI hides once this is selected, since it
+// no longer means anything) — a warm-up at the exercise's own "Reps" field, then one rest-pause
+// work set. Doing the full activation+bursts protocol several times over isn't how rest-pause is
+// actually trained, so this is a structural replacement, not a per-row stamp like drop-set.
+{ intensifier: { type: 'restpause', totalReps: 12, restSec: 15 } }
+```
+
+`applyIntensifierPlan(sets, cfg)` (`history.js`) applies that. It must run **after**
+`applyPrescription`: a drop-set's chain of drops is a percentage of each row's own `w`, so it has
+to use the final prescribed weight, not the pre-progression one `buildSets` started from — same
+reasoning for where the two rest-pause rows get their weight from. Both call sites chain it last:
+
+```js
+applyIntensifierPlan(applyPrescription(buildSets(st, cfg), plan), cfg) // beginWorkout, sheets.jsx
+applyIntensifierPlan(freestyle ? sets : applyPrescription(sets, plan), full) // add-exercise, Workout.jsx
+```
+
+`buildSets` itself knows nothing about intensifiers — it only builds the plain rows (for
+rest-pause, `applyIntensifierPlan` discards all of them but the weight).
+
+**Known open questions, deliberately left alone for now:**
+- The progression engine (`readSession`/`nextPrescription`) judges a rest-pause exercise's one
+ non-warm-up row against `target.reps` — the exercise's plain "Reps" field (what the *warm-up*
+ row uses), compared against the work row's `r`, which is now the rest-pause *total* and so is
+ usually well above that goal. In practice this means a rest-pause exercise will almost always
+ read as "hit the goal" and progress — not obviously wrong, but not a deliberately designed
+ comparison either.
+- `onerm.js`'s `estimate1RM` refuses anything past `REP_CAP` (12 reps) as "work capacity, not
+ strength" — a rest-pause row's `r` being the total means any rest-pause exercise with a total
+ over 12 (most of them) never contributes a 1RM estimate or PR. Also not fixed — it falls out
+ naturally from an existing, deliberate rule, not a new one, but worth knowing it applies here.
+
+## Guided workout UI (`Workout.jsx`)
+
+Every non-warm-up reps-mode row renders its drops/clusters as **editable sub-rows** right under
+it (`.subrow`, reusing the same stepper look as the main row, just smaller) — not read-only chips
+behind a sheet. A planned exercise arrives with these already filled in; nothing needs pressing
+for them to show up. `"+ Drop"`/`"+ Burst"` (hidden on whichever type doesn't apply to that row)
+just appends one more entry with the same suggested-next-value math
+(`nextDropWeight`/`nextBurstReps`), for a drop/burst beyond what was planned, or for turning an
+unplanned straight set into one on the spot.
+
+There is deliberately **no countdown timer** for rest-pause bursts anymore (an earlier version of
+this had one, using the work-timer bar) — with the burst rows already pre-filled and editable,
+forcing a real-time countdown added friction without adding value; the short rest between bursts
+is self-timed.
+
+**Testing gotcha, not a code bug:** `S.active` (the in-progress workout) and each routine's saved
+`intensifier` config both live in `localStorage` and are untouched by redeploying the container.
+Iterating on this feature while an old workout is still active, or without re-saving an
+already-configured exercise, replays stale pre-`totalReps` data. Discard the active workout and
+re-save the exercise's config after a schema change like this one.
+
+## Settings (`useStore.js` DEF, `Settings.jsx`)
+
+`S.restPauseSec` (default 15) is the fallback rest used when "+ Burst" is tapped on a set with no
+planned rest-pause of its own. It's a real user-editable default now — **Settings → During a
+workout → Rest-pause rest** — the same pattern as the existing `S.restSec` (long) rest timer.
+A planned exercise's own `intensifier.restSec` always overrides this.
+
+## Why most of the app didn't need to change
+
+1RM estimation (`onerm.js`) and the progression engine (`progression.js`) read a set row's own
+`w`/`r`/`sec` directly, never anything nested — so a drop-set's main set, or a rest-pause row's
+own total, is automatically the only thing they see; `drops`/`clusters` never had to be taught to
+either of them. What *did* need a one-line hook, because they sum across a session rather than
+reading one row:
+
+- `workoutVolume` (`history.js`) — adds `extraVolumeOf(s)` on top of `w×r` per row. Drop-set
+ drops count; rest-pause clusters don't (see above — they're already inside the row's own `r`).
+- `setTonnage` (`recovery.js`) — same split: `extraTonnage(...)` prices a drop-set's drops with
+ the same intensity-weighted formula (`load × reps × min(1, load/1RM)^1.5`) as the main set, and
+ is a no-op for rest-pause for the same double-counting reason.
+- `applyPrescription` (`progression.js`) — when a policy grows the set count (bodyweight double
+ progression, issue #33), the newly appended row keeps the seed's `type` (that's the exercise's
+ plan) but never its already-logged `drops`/`clusters` (that's specific work the new row never
+ actually did).
+
+`muscles.js`'s `loadOf` ("effective sets" for the muscle-balance map) is untouched on purpose: a
+drop-set/rest-pause row still counts as one set there, same as today — that model was never
+weight-based to begin with.
+
+## Persistence
+
+No backend or schema change was needed. `api/server.js` writes `state-<uid>.json` verbatim with
+no set-shape validation beyond "is an object". The MCP server (`mcp/src`) re-imports the same
+`workoutVolume`/`onerm.js`/`muscles.js` helpers from `frontend/src/lib` rather than duplicating
+them, so its reported volume/1RM figures pick up the fix automatically too.
+
+## i18n
+
+All new strings are translated in `locales/es.js` (the other ten locales fall back to English via
+`t()`, which is safe but not localized — nobody's asked for those yet).
+
+## Out of scope for this pass
+
+- Import from other apps (FitNotes/Strong/Hevy) — no equivalent concept there yet.
+- Planning which *specific* sets of an exercise get the intensifier — it's all-or-nothing per
+ exercise (every set), which is what was asked for; a "last set only" option would need a
+ per-row opt-out on top of this.
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 803c0f4fc..2e19b20d9 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "opengym-frontend",
- "version": "1.2.7",
+ "version": "1.2.9",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "opengym-frontend",
- "version": "1.2.7",
+ "version": "1.2.9",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@capacitor/app": "^7.1.2",
diff --git a/frontend/src/index.css b/frontend/src/index.css
index a6be108b0..376bf10f7 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -585,6 +585,18 @@ h4.sec{
.setrow.eff3 .stp .num{font-size:14px}
.setrow.done .n{background:var(--acc);color:var(--on-acc)}
.setrow.done{opacity:.45}
+/* drop-set drops / rest-pause bursts riding on a work row, editable like the row itself
+ (issue: drop-sets & rest-pause) */
+.subrow{display:flex;align-items:center;gap:6px;padding:3px 0 3px 32px}
+.subrow .subn{font-size:11px;color:var(--label-3);flex:none;width:46px}
+.subrow .stp.mini{flex:1;min-width:0}
+.subrow .stp.mini button{width:26px;height:30px}
+.subrow .stp.mini .num{font-size:13px}
+.subrow .iconbtn{width:26px;height:26px;font-size:11px;flex:none}
+.setextra{display:flex;flex-wrap:wrap;gap:6px;margin:2px 0 8px 32px}
+.setextra .chip.add{display:inline-flex;align-items:center;gap:4px;color:var(--acc)}
+.setextra .chip.add svg{width:13px;height:13px}
+.setextra .chip.add:disabled{opacity:.35}
/* why the next target is what it is (issue #17) */
.progline{
display:flex;align-items:flex-start;gap:7px;margin:6px 0 2px;
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index 9c440aebd..db3443833 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -1,7 +1,7 @@
// Pure helpers over the state object S (ported 1:1 from the vanilla app).
import { todayISO, isoOf, weekKey, fmtNum } from './format.js'
import { isCardio, isBodyweightEq } from './exercises.js'
-import { phaseForSet, modeForSet, modeForEntry, isWarmupRow, normalizeMode } from './workout-model.js'
+import { phaseForSet, modeForSet, modeForEntry, isWarmupRow, normalizeMode, extraVolumeOf, nextDropWeight, splitBurstReps } from './workout-model.js'
const objectOf = value => value && typeof value === 'object' && !Array.isArray(value) ? value : {}
// Completed-state-independent work rows whose authoritative mode matches the requested mode.
const workRowsForMode = (entry = {}, mode = 'reps') => {
@@ -286,11 +286,51 @@ export function buildSets(S, cfg, options = {}) {
}
return sets
}
+
+/**
+ * Stamp every work row with the exercise's planned intensifier and pre-fill its drops/clusters,
+ * already computed and editable — the plan designs the set, not a button pressed mid-workout.
+ *
+ * Must run AFTER applyPrescription: a drop-set's chain of drops is a percentage of each row's
+ * own `w`, so it has to be computed from the final prescribed weight, not the pre-progression
+ * one buildSets started from — otherwise a bumped working weight would leave stale, cheaper
+ * drops sitting underneath it.
+ */
+export function applyIntensifierPlan(sets, cfg) {
+ const kind = cfg && cfg.intensifier && cfg.intensifier.type
+ if (kind !== 'dropset' && kind !== 'restpause') return sets
+ if (kind === 'dropset') {
+ const count = Math.max(1, Math.round(cfg.intensifier.count) || 1)
+ const pct = cfg.intensifier.pct
+ return sets.map(s => {
+ if (isWarmupRow(s)) return s
+ const drops = []
+ let w = s.w || 0
+ for (let k = 0; k < count; k++) { w = nextDropWeight(w, pct); drops.push({ w, r: s.r }) }
+ return { ...s, type: 'dropset', drops }
+ })
+ }
+ // Rest-pause trains as exactly two sets, not one per configured `sets` count: a warm-up at
+ // the exercise's own configured reps, then a single rest-pause work set. Doing the full
+ // activation+bursts protocol several times over isn't how rest-pause is actually trained, so
+ // planning it replaces whatever buildSets built rather than stamping each of those rows.
+ // The work row's own reps are the total — not "the total minus what the bursts carry" — and
+ // the bursts are the full breakdown of that same total, down to the last one. See
+ // extraVolumeOf/setTonnage: a rest-pause row's `clusters` are read-only display of how `r`
+ // breaks down, not extra volume on top of it, precisely so this doesn't double-count.
+ const restSec = Math.max(5, cfg.intensifier.restSec || 15)
+ const totalReps = Math.max(1, Math.round(cfg.intensifier.totalReps) || 1)
+ const w = (sets.find(s => !isWarmupRow(s)) || sets[0] || {}).w || 0
+ const warmup = { w, r: Math.max(1, Math.round(cfg.reps) || 1), done: false, phase: 'warmup' }
+ const work = { w, r: totalReps, done: false, type: 'restpause', clusters: splitBurstReps(totalReps).map(r => ({ r, restSec })) }
+ return [warmup, work]
+}
export function workoutVolume(w) {
let v = 0
// No special case for unilateral work: a per-side set logs its total, so both sides are
- // already in the rep count that arrives here.
- w.entries.forEach(e => e.sets.forEach(s => { if (s.done) v += (s.w || 0) * (s.r || 0) }))
+ // already in the rep count that arrives here. Drop-set drops and rest-pause bursts add their
+ // own weight x reps on top of the row's main/activation set (see extraVolumeOf).
+ w.entries.forEach(e => e.sets.forEach(s => { if (s.done) v += (s.w || 0) * (s.r || 0) + extraVolumeOf(s) }))
return v
}
export function setsDone(w) {
diff --git a/frontend/src/lib/history.test.js b/frontend/src/lib/history.test.js
index 352972e5e..39b89c451 100644
--- a/frontend/src/lib/history.test.js
+++ b/frontend/src/lib/history.test.js
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
-import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, freestyleConfig, exLine, workoutVolume, bestWeightFor, bestWeightForEntry, effortOf, stepEffort, capEffort, isBw, isPerSide, sideReps, repStep, cascadeWeight, insertWarmupRow, removeRowAt, workSetsDone, pairAdjacent, unpairSuperset, supersetUnits } from './history.js'
+import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, freestyleConfig, exLine, workoutVolume, bestWeightFor, bestWeightForEntry, effortOf, stepEffort, capEffort, isBw, isPerSide, sideReps, repStep, cascadeWeight, insertWarmupRow, removeRowAt, workSetsDone, pairAdjacent, unpairSuperset, supersetUnits, applyIntensifierPlan } from './history.js'
import { EXDB } from './exercises.js'
// Real ids out of the shipped catalogue, so the body-part fallback is exercised for real.
@@ -456,6 +456,55 @@ describe('buildSets', () => {
expect(buildSets(S, { id: LIFT, sets: 2, reps: 8, weight: 50 }, { preferLast: true }))
.toEqual([{ w: 60, r: 10, done: false }, { w: 62.5, r: 8, done: false }])
})
+
+})
+
+describe('applyIntensifierPlan', () => {
+ it('pre-fills every work row with a chain of drops, each pct% lighter than the one before', () => {
+ const sets = [{ w: 100, r: 8, done: false }, { w: 100, r: 8, done: false }]
+ const out = applyIntensifierPlan(sets, { intensifier: { type: 'dropset', count: 2, pct: 20 } })
+ expect(out).toEqual([
+ { w: 100, r: 8, done: false, type: 'dropset', drops: [{ w: 80, r: 8 }, { w: 64, r: 8 }] },
+ { w: 100, r: 8, done: false, type: 'dropset', drops: [{ w: 80, r: 8 }, { w: 64, r: 8 }] },
+ ])
+ })
+
+ it('collapses rest-pause to exactly two rows regardless of how many sets were configured: a warm-up at the exercise\'s own reps, then one work set whose own reps ARE the total', () => {
+ const sets = [{ w: 60, r: 8, done: false }, { w: 60, r: 8, done: false }, { w: 60, r: 8, done: false }]
+ const out = applyIntensifierPlan(sets, { reps: 8, intensifier: { type: 'restpause', totalReps: 12, restSec: 15 } })
+ expect(out).toEqual([
+ { w: 60, r: 8, done: false, phase: 'warmup' },
+ { w: 60, r: 12, done: false, type: 'restpause', clusters: [{ r: 6, restSec: 15 }, { r: 3, restSec: 15 }, { r: 2, restSec: 15 }, { r: 1, restSec: 15 }] },
+ ])
+ // the full breakdown always sums back to the row's own r — no reps missing, none double-counted
+ expect(out[1].clusters.reduce((sum, c) => sum + c.r, 0)).toBe(out[1].r)
+ })
+
+ it('the warm-up reps come from the exercise\'s own configured reps, not the rest-pause total', () => {
+ const sets = [{ w: 60, r: 8, done: false }]
+ const out = applyIntensifierPlan(sets, { reps: 5, intensifier: { type: 'restpause', totalReps: 20, restSec: 15 } })
+ expect(out[0]).toEqual({ w: 60, r: 5, done: false, phase: 'warmup' })
+ })
+
+ it('carries the prescribed weight from the built sets onto both new rows', () => {
+ const sets = [{ w: 82.5, r: 8, done: false }]
+ const out = applyIntensifierPlan(sets, { reps: 8, intensifier: { type: 'restpause', totalReps: 4, restSec: 15 } })
+ expect(out[0].w).toBe(82.5)
+ expect(out[1].w).toBe(82.5)
+ })
+
+ it('never touches a warm-up row', () => {
+ const sets = [{ w: 20, r: 8, done: false, phase: 'warmup' }, { w: 100, r: 8, done: false }]
+ const out = applyIntensifierPlan(sets, { intensifier: { type: 'dropset', count: 1, pct: 20 } })
+ expect(out[0]).toEqual({ w: 20, r: 8, done: false, phase: 'warmup' })
+ expect(out[1].type).toBe('dropset')
+ })
+
+ it('leaves sets untouched with no intensifier configured', () => {
+ const sets = [{ w: 100, r: 8, done: false }]
+ expect(applyIntensifierPlan(sets, {})).toBe(sets)
+ expect(applyIntensifierPlan(sets, { intensifier: { type: 'nonsense' } })).toBe(sets)
+ })
})
describe('workoutVolume', () => {
@@ -473,6 +522,21 @@ describe('workoutVolume', () => {
expect(workoutVolume(w)).toBe(320)
})
+ it('adds drop-set drops on top of the row\'s main set', () => {
+ const dropRow = { type: 'dropset', w: 100, r: 5, done: true, drops: [{ w: 80, r: 5 }, { w: 60, r: 5 }] }
+ expect(workoutVolume({ entries: [{ id: LIFT, sets: [dropRow] }] })).toBe(100 * 5 + 80 * 5 + 60 * 5)
+ })
+
+ it('counts a rest-pause row once — its own r is already the total across every burst', () => {
+ const burstRow = { type: 'restpause', w: 60, r: 20, done: true, clusters: [{ r: 10, restSec: 15 }, { r: 5, restSec: 15 }, { r: 3, restSec: 15 }, { r: 1, restSec: 15 }, { r: 1, restSec: 15 }] }
+ expect(workoutVolume({ entries: [{ id: LIFT, sets: [burstRow] }] })).toBe(60 * 20)
+ })
+
+ it('ignores drops/bursts on a row that was never checked off', () => {
+ const dropRow = { type: 'dropset', w: 100, r: 5, done: false, drops: [{ w: 80, r: 5 }] }
+ expect(workoutVolume({ entries: [{ id: LIFT, sets: [dropRow] }] })).toBe(0)
+ })
+
it('leaves an unloaded bodyweight set at zero volume rather than inventing a number', () => {
const w = { entries: [{ id: BW, target: { bodyweight: true }, sets: [{ w: 0, r: 20, done: true }] }] }
expect(workoutVolume(w)).toBe(0)
diff --git a/frontend/src/lib/onerm.test.js b/frontend/src/lib/onerm.test.js
index 59a4f9e96..e1c5c5dcb 100644
--- a/frontend/src/lib/onerm.test.js
+++ b/frontend/src/lib/onerm.test.js
@@ -148,6 +148,32 @@ describe('is1RMRecord', () => {
})
+describe('drop-sets, rest-pause sets and 1RM', () => {
+ it('estimates only from the main/activation weight×reps, ignoring lighter drops', () => {
+ const entry = { id: 'x', sets: [
+ { type: 'dropset', w: 100, r: 5, done: true, drops: [{ w: 80, r: 5 }, { w: 60, r: 5 }] },
+ ] }
+ expect(bestSetOf(entry)).toEqual(bestSetOf({ id: 'x', sets: [{ w: 100, r: 5, done: true }] }))
+ })
+
+ it('estimates only from the row\'s own w/r, ignoring rest-pause bursts', () => {
+ const entry = { id: 'x', sets: [
+ { type: 'restpause', w: 60, r: 8, done: true, clusters: [{ r: 4, restSec: 15 }, { r: 3, restSec: 15 }] },
+ ] }
+ expect(bestSetOf(entry)).toEqual(bestSetOf({ id: 'x', sets: [{ w: 60, r: 8, done: true }] }))
+ })
+
+ it('refuses to estimate a planned rest-pause row once its total reps exceed REP_CAP, same as any other high-rep set', () => {
+ // A planned rest-pause row's own r is the total across every burst (see
+ // applyIntensifierPlan/history.js), so it commonly lands above REP_CAP — the row is real
+ // work, but "estimate a max from 20 broken-up reps" is exactly the fantasy REP_CAP refuses.
+ const entry = { id: 'x', sets: [
+ { type: 'restpause', w: 60, r: 20, done: true, clusters: [{ r: 10, restSec: 15 }, { r: 5, restSec: 15 }, { r: 3, restSec: 15 }, { r: 1, restSec: 15 }, { r: 1, restSec: 15 }] },
+ ] }
+ expect(bestSetOf(entry)).toBeNull()
+ })
+})
+
describe('warm-up sets and 1RM', () => {
const ENTRY = { id: 'warm-test', sets: [
{ w: 20, r: 8, done: true, warmup: true },
diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.js
index 8248df7c7..cd80ece7f 100644
--- a/frontend/src/lib/progression.js
+++ b/frontend/src/lib/progression.js
@@ -272,7 +272,12 @@ export function applyPrescription(sets, p) {
// would both invent work and never terminate the loop. Leave the entry untouched.
if (!workRows.length) return out
const seed = workRows[workRows.length - 1]
- while (out.filter(s => !isWarmupRow(s)).length < p.sets) out.push({ ...seed, done: false })
+ // A freshly appended row hasn't been performed, so it never inherits a seed's already-
+ // logged drops/clusters — that would invent extra work the row never actually did. Its
+ // `type` is kept: that's the exercise's plan (every set is a drop-set/rest-pause), not
+ // something this particular row logged.
+ const { drops, clusters, ...plainSeed } = seed
+ while (out.filter(s => !isWarmupRow(s)).length < p.sets) out.push({ ...plainSeed, done: false })
}
return out
}
diff --git a/frontend/src/lib/progression.test.js b/frontend/src/lib/progression.test.js
index a0e741f5f..7cc1c5188 100644
--- a/frontend/src/lib/progression.test.js
+++ b/frontend/src/lib/progression.test.js
@@ -523,3 +523,34 @@ describe('applyPrescription never touches warm-up rows (round 3)', () => {
expect(out).toEqual(sets) // no work row to seed growth from - nothing grows, no loop
})
})
+
+describe('drop-sets and rest-pause sets in progression', () => {
+ it('readSession judges a drop-set row on its own main weight/reps, ignoring the drops', () => {
+ const withDrops = readSession({ id: LIFT, target: { sets: 1, reps: 5 }, sets: [
+ { type: 'dropset', w: 60, r: 5, done: true, drops: [{ w: 40, r: 8 }, { w: 20, r: 10 }] },
+ ] })
+ const plain = readSession({ id: LIFT, target: { sets: 1, reps: 5 }, sets: [{ w: 60, r: 5, done: true }] })
+ expect(withDrops).toEqual(plain)
+ })
+
+ it('readSession judges a rest-pause row on its activation weight/reps, ignoring the bursts', () => {
+ const withBursts = readSession({ id: LIFT, target: { sets: 1, reps: 8 }, sets: [
+ { type: 'restpause', w: 60, r: 8, done: true, clusters: [{ r: 4, restSec: 15 }, { r: 3, restSec: 15 }] },
+ ] })
+ const plain = readSession({ id: LIFT, target: { sets: 1, reps: 8 }, sets: [{ w: 60, r: 8, done: true }] })
+ expect(withBursts).toEqual(plain)
+ })
+
+ it('applyPrescription still rewrites a drop-set/rest-pause row\'s own weight, leaving its drops/clusters untouched', () => {
+ const sets = [{ type: 'dropset', w: 60, r: 5, done: false, drops: [{ w: 40, r: 8 }] }]
+ const out = applyPrescription(sets, { kind: 'up', weight: 62.5 })
+ expect(out[0]).toEqual({ type: 'dropset', w: 62.5, r: 5, done: false, drops: [{ w: 40, r: 8 }] })
+ })
+
+ it('a newly grown row keeps the seed\'s planned type but not its already-logged drops/clusters', () => {
+ const sets = [{ type: 'dropset', w: 0, r: 10, done: false, drops: [{ w: 0, r: 12 }] }]
+ const out = applyPrescription(sets, { kind: 'up', weight: 0, reps: 10, sets: 2 })
+ expect(out).toHaveLength(2)
+ expect(out[1]).toEqual({ type: 'dropset', w: 0, r: 10, done: false })
+ })
+})
diff --git a/frontend/src/lib/recovery.js b/frontend/src/lib/recovery.js
index a1b2f3ba8..7ab6f4592 100644
--- a/frontend/src/lib/recovery.js
+++ b/frontend/src/lib/recovery.js
@@ -1,6 +1,6 @@
import { EXIDX } from './exercises.js'
import { MUSCLES, musclesOf } from './muscles.js'
-import { isWarmupRow } from './workout-model.js'
+import { isWarmupRow, dropsOf } from './workout-model.js'
// A "normal" hard session for one muscle, in primary-set equivalents. The saturation curve
// 1 - exp(-stimulus / REF) maps any session size onto [0,1) so volume raises the starting
@@ -172,6 +172,25 @@ function session1RMs(workout, opts = {}) {
return best
}
+// Extra tonnage from a drop-set's drops, weighted the same way as the row's own main set — a
+// drop taken near failure counts the same as any other hard rep for fatigue purposes, it just
+// carries its own (usually lighter) load.
+//
+// A rest-pause row's `clusters` are NOT extra here: the row's own `r` already is the total reps
+// across every burst (see applyIntensifierPlan/history.js), so the main tonnage term below
+// already covers it — adding clusters on top would double-count the same reps.
+function extraTonnage(ex, entry, set, workout, oneRm, opts = {}) {
+ const drops = dropsOf(set)
+ if (!drops.length) return 0
+ const isBwEx = bodyweightConfigured(ex, entry, set, workout, opts)
+ const weigh = (load, reps) => {
+ if (!(load > 0) || !(reps > 0)) return 0
+ const raw = load * reps
+ return isBwEx || !(oneRm > 0) ? raw : raw * Math.min(1, load / oneRm) ** 1.5
+ }
+ return drops.reduce((sum, d) => sum + weigh(loadKgFor(ex, entry, d, workout, opts), Number(d?.r) || 0), 0)
+}
+
// Intensity-weighted tonnage for one completed set: load x reps x (load / exercise 1RM)^1.5.
// The exponent saturates the "hard set" effect - a set at 90% of your 1RM counts ~0.81 of its
// raw tonnage, one at 50% only ~0.35. Cardio, timed holds, and sets whose exercise has no
@@ -186,13 +205,14 @@ function setTonnage(ex, entry, set, workout, oneRm, opts = {}) {
const reps = set?.r || 1
const load = loadKgFor(ex, entry, set, workout, opts)
const raw = load * reps
+ const extra = extraTonnage(ex, entry, set, workout, oneRm, opts)
// A bodyweight target is already an external-load-normalised total (body mass + any added
// load). It has no meaningful barbell-style 1RM intensity ratio in the legacy data model, so
// retain the monotonic total-load stimulus instead of letting a newly created low 1RM shrink
// a weighted bodyweight set below the unloaded version.
- if (bodyweightConfigured(ex, entry, set, workout, opts)) return raw
- if (!(oneRm > 0) || !(load > 0)) return raw
- return raw * Math.min(1, load / oneRm) ** 1.5
+ if (bodyweightConfigured(ex, entry, set, workout, opts)) return raw + extra
+ if (!(oneRm > 0) || !(load > 0)) return raw + extra
+ return raw * Math.min(1, load / oneRm) ** 1.5 + extra
}
// One session's per-muscle stimulus, calculated only from that session. A completed zero-load
diff --git a/frontend/src/lib/recovery.test.js b/frontend/src/lib/recovery.test.js
index 884f814f0..4ec20070d 100644
--- a/frontend/src/lib/recovery.test.js
+++ b/frontend/src/lib/recovery.test.js
@@ -403,6 +403,47 @@ describe('warm-up flag in strength and fatigue', () => {
})
})
+describe('drop-set drops add fatigue tonnage on top of the main set', () => {
+ // Same within-session Epley baseline setTonnage derives from the row's own w/r (8 reps,
+ // under REP_CAP), so a drop is weighted against the same 1RM as the main set.
+ const oneRm = 80 * (1 + 8 / 30)
+
+ it('a drop-set drop adds its own intensity-weighted tonnage', () => {
+ const dropRow = { done: true, type: 'dropset', w: 80, r: 8, drops: [{ w: 60, r: 6 }] }
+ const dropTonnage = 60 * 6 * Math.min(1, 60 / oneRm) ** 1.5
+ const expected = expectedFatigue([{ stimulus: V + dropTonnage }])
+
+ expect(fatigueOf([workoutAt(SINGLE.id, NOW, [dropRow])], NOW)[SINGLE_SLUG]).toBeCloseTo(expected, 8)
+ // strictly more than the plain 80x8 set alone — the drop is real extra work
+ expect(fatigueOf([workoutAt(SINGLE.id, NOW, [dropRow])], NOW)[SINGLE_SLUG])
+ .toBeGreaterThan(fatigueOf([doneWorkoutAt(SINGLE.id, NOW)], NOW)[SINGLE_SLUG])
+ })
+
+ it('leaves fatigue unchanged for a straight set with no drops', () => {
+ const plain = { done: true, w: 80, r: 8 }
+ expect(fatigueOf([workoutAt(SINGLE.id, NOW, [plain])], NOW)[SINGLE_SLUG])
+ .toBeCloseTo(expectedFatigue([{ stimulus: V }]), 8)
+ })
+})
+
+describe('a rest-pause row\'s clusters add no extra fatigue tonnage', () => {
+ // Its own r is already the total across every burst (see applyIntensifierPlan/history.js),
+ // so setTonnage's main w x r term already covers all of it — clusters are a breakdown only.
+ it('matches a plain set of the same w/r exactly, regardless of how the clusters break it down', () => {
+ const burstRow = { done: true, type: 'restpause', w: 80, r: 8, clusters: [{ r: 4, restSec: 15 }] }
+ const plainRow = { done: true, w: 80, r: 8 }
+ expect(fatigueOf([workoutAt(SINGLE.id, NOW, [burstRow])], NOW)[SINGLE_SLUG])
+ .toBeCloseTo(fatigueOf([workoutAt(SINGLE.id, NOW, [plainRow])], NOW)[SINGLE_SLUG], 10)
+ })
+
+ it('holds for a realistic planned total too — a full descending split adds nothing beyond the row\'s own r', () => {
+ const burstRow = { done: true, type: 'restpause', w: 80, r: 20, clusters: [{ r: 10, restSec: 15 }, { r: 5, restSec: 15 }, { r: 3, restSec: 15 }, { r: 1, restSec: 15 }, { r: 1, restSec: 15 }] }
+ const plainRow = { done: true, w: 80, r: 20 }
+ expect(fatigueOf([workoutAt(SINGLE.id, NOW, [burstRow])], NOW)[SINGLE_SLUG])
+ .toBeCloseTo(fatigueOf([workoutAt(SINGLE.id, NOW, [plainRow])], NOW)[SINGLE_SLUG], 10)
+ })
+})
+
describe('canonical loads and configured bodyweight', () => {
const loaded = EXDB.find(ex => {
const weights = musclesOf(ex)
diff --git a/frontend/src/lib/workout-model.js b/frontend/src/lib/workout-model.js
index e296ee608..fda0d317a 100644
--- a/frontend/src/lib/workout-model.js
+++ b/frontend/src/lib/workout-model.js
@@ -22,6 +22,112 @@ export function isWarmupRow(set) {
return phaseForSet(set) === 'warmup'
}
+// A row's shape beyond warm-up/work: 'straight' (default), 'dropset' (a main set followed by
+// weight drops logged with no rest) or 'restpause' (an activation set followed by short-rest
+// bursts). Both extras ride on the row itself — same card, not a new set in the array — the
+// same trick `phase` uses for warm-ups, so the rest of the app can keep reading a row's own
+// `w`/`r` and stay correct without knowing this field exists.
+export function setType(set) {
+ const source = objectOf(set)
+ return source.type === 'dropset' || source.type === 'restpause' ? source.type : 'straight'
+}
+export const isDropSet = set => setType(set) === 'dropset'
+export const isRestPauseSet = set => setType(set) === 'restpause'
+
+/** A drop-set's weight drops, oldest first; empty for anything else. */
+export function dropsOf(set) {
+ const source = objectOf(set)
+ return isDropSet(source) && Array.isArray(source.drops) ? source.drops : []
+}
+
+/** A rest-pause set's short-rest bursts, oldest first; empty for anything else. */
+export function clustersOf(set) {
+ const source = objectOf(set)
+ return isRestPauseSet(source) && Array.isArray(source.clusters) ? source.clusters : []
+}
+
+/**
+ * Weight x reps from a drop-set's drops, on top of its own main set. The 1RM estimate and the
+ * progression engine deliberately read only a row's own `w`/`r` (the heaviest effort), so this
+ * is the one place a drop-set's extra volume gets added back in for totals.
+ *
+ * A rest-pause row is different: its own `r` IS the total (every burst's reps included), and
+ * `clusters` is only how that total breaks down — not extra volume on top of it. Adding
+ * `clustersOf(set)` here as well would double-count the same reps twice.
+ */
+export function extraVolumeOf(set) {
+ const drops = dropsOf(set)
+ return drops.reduce((v, d) => v + (Number(d?.w) || 0) * (Number(d?.r) || 0), 0)
+}
+
+/** Append a weight drop to a row, marking it a drop-set. */
+export function addDrop(set, drop) {
+ const prev = Array.isArray(objectOf(set).drops) ? objectOf(set).drops : []
+ return { ...objectOf(set), type: 'dropset', drops: [...prev, { w: Number(drop?.w) || 0, r: Number(drop?.r) || 0 }] }
+}
+
+/** Append a short-rest burst to a row, marking it a rest-pause set. */
+export function addCluster(set, cluster) {
+ const prev = Array.isArray(objectOf(set).clusters) ? objectOf(set).clusters : []
+ return { ...objectOf(set), type: 'restpause', clusters: [...prev, { r: Number(cluster?.r) || 0, restSec: Number(cluster?.restSec) || 0 }] }
+}
+
+/** Remove one drop by index. Clearing the last one reverts the row to a straight set. */
+export function removeDropAt(set, i) {
+ const drops = (objectOf(set).drops || []).filter((_, idx) => idx !== i)
+ return drops.length ? { ...objectOf(set), drops } : { ...objectOf(set), type: 'straight', drops }
+}
+
+/** Remove one burst by index. Clearing the last one reverts the row to a straight set. */
+export function removeClusterAt(set, i) {
+ const clusters = (objectOf(set).clusters || []).filter((_, idx) => idx !== i)
+ return clusters.length ? { ...objectOf(set), clusters } : { ...objectOf(set), type: 'straight', clusters }
+}
+
+/** Patch one drop's fields in place (weight/reps steppers edit an existing drop). */
+export function setDropAt(set, i, patch) {
+ const drops = (objectOf(set).drops || []).slice()
+ if (!drops[i]) return set
+ drops[i] = { ...drops[i], ...patch }
+ return { ...objectOf(set), drops }
+}
+
+/** Patch one burst's fields in place (a reps stepper edits an existing burst). */
+export function setClusterAt(set, i, patch) {
+ const clusters = (objectOf(set).clusters || []).slice()
+ if (!clusters[i]) return set
+ clusters[i] = { ...clusters[i], ...patch }
+ return { ...objectOf(set), clusters }
+}
+
+/** Suggested weight for the next drop: pct% lighter than the previous weight, rounded to .5. */
+export function nextDropWeight(prevWeight, pct = 20) {
+ const p = Math.min(90, Math.max(1, Number(pct) || 20))
+ return Math.round(Math.max(0, (Number(prevWeight) || 0) * (1 - p / 100)) * 2) / 2
+}
+
+/** Suggested reps for the next rest-pause burst: roughly half the previous rep count. */
+export function nextBurstReps(prevReps) {
+ return Math.max(1, Math.round((Number(prevReps) || 0) / 2))
+}
+
+/**
+ * Split a rest-pause total (the extra reps you want past the activation set) into a descending,
+ * roughly-halving sequence of bursts that adds back up to it — e.g. 12 -> [6, 3, 2, 1]. This is
+ * what a planned rest-pause exercise configures directly, rather than a burst count picked by
+ * hand: you say how many reps you want out of the whole rest-pause portion, not how many rests.
+ */
+export function splitBurstReps(total) {
+ const bursts = []
+ let remaining = Math.max(0, Math.round(Number(total) || 0))
+ while (remaining > 0) {
+ const burst = Math.min(remaining, nextBurstReps(remaining))
+ bursts.push(burst)
+ remaining -= burst
+ }
+ return bursts
+}
+
export function normalizeMode(value, fallback = 'reps') {
const token = typeof value === 'string' ? value.trim().toLowerCase() : ''
if (MODES.includes(token)) return token
diff --git a/frontend/src/lib/workout-model.test.js b/frontend/src/lib/workout-model.test.js
new file mode 100644
index 000000000..cbbbff158
--- /dev/null
+++ b/frontend/src/lib/workout-model.test.js
@@ -0,0 +1,181 @@
+import { describe, it, expect } from 'vitest'
+import {
+ phaseForSet, isWarmupRow, modeForSet, modeForEntry,
+ setType, isDropSet, isRestPauseSet, dropsOf, clustersOf, extraVolumeOf,
+ addDrop, addCluster, removeDropAt, removeClusterAt, setDropAt, setClusterAt,
+ nextDropWeight, nextBurstReps, splitBurstReps,
+} from './workout-model.js'
+
+describe('phaseForSet / isWarmupRow', () => {
+ it('reads both the explicit phase and the legacy boolean', () => {
+ expect(isWarmupRow({ phase: 'warmup' })).toBe(true)
+ expect(isWarmupRow({ warmup: true })).toBe(true)
+ expect(isWarmupRow({ phase: 'work' })).toBe(false)
+ expect(isWarmupRow({})).toBe(false)
+ })
+})
+
+describe('setType / isDropSet / isRestPauseSet', () => {
+ it('defaults to straight for anything without a recognised type', () => {
+ expect(setType({})).toBe('straight')
+ expect(setType({ type: 'nonsense' })).toBe('straight')
+ expect(setType(null)).toBe('straight')
+ expect(isDropSet({})).toBe(false)
+ expect(isRestPauseSet({})).toBe(false)
+ })
+
+ it('recognises drop-set and rest-pause rows', () => {
+ expect(setType({ type: 'dropset' })).toBe('dropset')
+ expect(isDropSet({ type: 'dropset' })).toBe(true)
+ expect(setType({ type: 'restpause' })).toBe('restpause')
+ expect(isRestPauseSet({ type: 'restpause' })).toBe(true)
+ })
+
+ it('is a separate axis from warm-up — a row is not both at once by construction, but phase never leaks into type', () => {
+ expect(setType({ phase: 'warmup', type: 'dropset' })).toBe('dropset')
+ expect(isWarmupRow({ phase: 'warmup', type: 'dropset' })).toBe(true)
+ })
+})
+
+describe('dropsOf / clustersOf', () => {
+ it('only return rows for their own type', () => {
+ const drop = { type: 'dropset', drops: [{ w: 80, r: 5 }] }
+ const burst = { type: 'restpause', clusters: [{ r: 4, restSec: 15 }] }
+ expect(dropsOf(drop)).toEqual([{ w: 80, r: 5 }])
+ expect(clustersOf(drop)).toEqual([])
+ expect(clustersOf(burst)).toEqual([{ r: 4, restSec: 15 }])
+ expect(dropsOf(burst)).toEqual([])
+ })
+
+ it('is defensive about missing/malformed arrays', () => {
+ expect(dropsOf({ type: 'dropset' })).toEqual([])
+ expect(dropsOf({ type: 'dropset', drops: 'nope' })).toEqual([])
+ expect(clustersOf(null)).toEqual([])
+ })
+})
+
+describe('extraVolumeOf', () => {
+ it('sums weight x reps across a drop-set\'s own drops', () => {
+ const set = { type: 'dropset', w: 100, r: 5, drops: [{ w: 80, r: 5 }, { w: 60, r: 6 }] }
+ expect(extraVolumeOf(set)).toBe(80 * 5 + 60 * 6)
+ })
+
+ it('is zero for rest-pause — its own r is already the total across every burst, so clusters are a breakdown, not extra volume', () => {
+ const set = { type: 'restpause', w: 60, r: 20, clusters: [{ r: 10, restSec: 15 }, { r: 5, restSec: 15 }, { r: 3, restSec: 15 }, { r: 1, restSec: 15 }, { r: 1, restSec: 15 } ] }
+ expect(extraVolumeOf(set)).toBe(0)
+ })
+
+ it('is zero for a straight or warm-up set', () => {
+ expect(extraVolumeOf({ w: 100, r: 5 })).toBe(0)
+ expect(extraVolumeOf({ phase: 'warmup', w: 20, r: 8 })).toBe(0)
+ })
+})
+
+describe('addDrop / addCluster', () => {
+ it('appends a drop and stamps the row as a drop-set', () => {
+ const set = { w: 100, r: 5, done: true }
+ const next = addDrop(set, { w: 80, r: 5 })
+ expect(next.type).toBe('dropset')
+ expect(next.drops).toEqual([{ w: 80, r: 5 }])
+ expect(set.drops).toBeUndefined() // pure — the original row is untouched
+ expect(addDrop(next, { w: 60, r: 4 }).drops).toEqual([{ w: 80, r: 5 }, { w: 60, r: 4 }])
+ })
+
+ it('appends a burst and stamps the row as a rest-pause set', () => {
+ const set = { w: 60, r: 8, done: true }
+ const next = addCluster(set, { r: 4, restSec: 15 })
+ expect(next.type).toBe('restpause')
+ expect(next.clusters).toEqual([{ r: 4, restSec: 15 }])
+ })
+})
+
+describe('removeDropAt / removeClusterAt', () => {
+ it('removes one entry by index, leaving the rest in place', () => {
+ const set = { type: 'dropset', w: 100, r: 5, drops: [{ w: 80, r: 5 }, { w: 60, r: 5 }] }
+ expect(removeDropAt(set, 0).drops).toEqual([{ w: 60, r: 5 }])
+ })
+
+ it('removes one burst by index', () => {
+ const set = { type: 'restpause', w: 60, r: 8, clusters: [{ r: 4, restSec: 15 }, { r: 3, restSec: 15 }] }
+ expect(removeClusterAt(set, 1).clusters).toEqual([{ r: 4, restSec: 15 }])
+ })
+
+ it('reverts the row to a straight set once its last drop/burst is removed', () => {
+ const drop = { type: 'dropset', w: 100, r: 5, drops: [{ w: 80, r: 5 }] }
+ expect(removeDropAt(drop, 0)).toEqual({ type: 'straight', w: 100, r: 5, drops: [] })
+ expect(isDropSet(removeDropAt(drop, 0))).toBe(false)
+
+ const burst = { type: 'restpause', w: 60, r: 8, clusters: [{ r: 4, restSec: 15 }] }
+ expect(removeClusterAt(burst, 0)).toEqual({ type: 'straight', w: 60, r: 8, clusters: [] })
+ expect(isRestPauseSet(removeClusterAt(burst, 0))).toBe(false)
+ })
+})
+
+describe('setDropAt / setClusterAt', () => {
+ it('patches one drop\'s fields, leaving the others untouched', () => {
+ const set = { type: 'dropset', w: 100, r: 5, drops: [{ w: 80, r: 5 }, { w: 60, r: 5 }] }
+ expect(setDropAt(set, 0, { w: 82.5 }).drops).toEqual([{ w: 82.5, r: 5 }, { w: 60, r: 5 }])
+ expect(setDropAt(set, 1, { r: 6 }).drops).toEqual([{ w: 80, r: 5 }, { w: 60, r: 6 }])
+ })
+
+ it('patches one burst\'s reps', () => {
+ const set = { type: 'restpause', w: 60, r: 8, clusters: [{ r: 4, restSec: 15 }] }
+ expect(setClusterAt(set, 0, { r: 5 }).clusters).toEqual([{ r: 5, restSec: 15 }])
+ })
+
+ it('is a no-op for an index that does not exist', () => {
+ const set = { type: 'dropset', w: 100, r: 5, drops: [{ w: 80, r: 5 }] }
+ expect(setDropAt(set, 3, { w: 1 })).toBe(set)
+ })
+})
+
+describe('nextDropWeight / nextBurstReps', () => {
+ it('drops by the given percentage, rounded to the nearest .5', () => {
+ expect(nextDropWeight(100, 20)).toBe(80)
+ expect(nextDropWeight(80, 20)).toBe(64)
+ expect(nextDropWeight(61, 10)).toBe(55)
+ })
+
+ it('defaults to 20% and never goes negative', () => {
+ expect(nextDropWeight(100)).toBe(80)
+ expect(nextDropWeight(0, 20)).toBe(0)
+ })
+
+ it('roughly halves the previous rep count, floored at 1', () => {
+ expect(nextBurstReps(8)).toBe(4)
+ expect(nextBurstReps(1)).toBe(1)
+ expect(nextBurstReps(0)).toBe(1)
+ })
+})
+
+describe('splitBurstReps', () => {
+ it('splits a total into a descending, roughly-halving sequence that adds back up to it', () => {
+ expect(splitBurstReps(12)).toEqual([6, 3, 2, 1])
+ expect(splitBurstReps(6)).toEqual([3, 2, 1])
+ expect(splitBurstReps(1)).toEqual([1])
+ })
+
+ it('every split sums exactly to the requested total', () => {
+ for (const total of [1, 2, 3, 5, 7, 10, 15, 20, 33]) {
+ expect(splitBurstReps(total).reduce((a, b) => a + b, 0)).toBe(total)
+ }
+ })
+
+ it('is empty for zero or invalid input', () => {
+ expect(splitBurstReps(0)).toEqual([])
+ expect(splitBurstReps(-5)).toEqual([])
+ expect(splitBurstReps(undefined)).toEqual([])
+ })
+})
+
+describe('modeForSet / modeForEntry stay reps-mode for drop-sets and rest-pause sets', () => {
+ it('infers reps mode from the row\'s own r field regardless of type', () => {
+ expect(modeForSet({ type: 'dropset', w: 100, r: 5 })).toBe('reps')
+ expect(modeForSet({ type: 'restpause', w: 60, r: 8 })).toBe('reps')
+ })
+
+ it('an entry mixing straight and drop-set rows still reads as one reps-mode entry', () => {
+ const entry = { sets: [{ w: 100, r: 5 }, { type: 'dropset', w: 100, r: 5, drops: [{ w: 80, r: 5 }] }] }
+ expect(modeForEntry(entry)).toBe('reps')
+ })
+})
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 99b88cc53..16d682397 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -163,6 +163,24 @@ export default {
'Warm-up': 'Calentamiento',
'Add warm-up set': 'Añadir serie de calentamiento',
'Add set': 'Añadir serie',
+ '+ Drop': '+ Bajada',
+ '+ Burst': '+ Ráfaga',
+ 'Drop {0}': 'Bajada {0}',
+ 'Burst {0}': 'Ráfaga {0}',
+ 'Remove drop': 'Quitar bajada',
+ 'Remove burst': 'Quitar ráfaga',
+ 'Rest (s)': 'Descanso (s)',
+ 'Drop-set / rest-pause': 'Series descendentes / rest-pause',
+ 'Intensifier': 'Intensificador',
+ 'None': 'Ninguno',
+ 'Drop-set': 'Serie descendente',
+ 'Rest-pause': 'Rest-pause',
+ 'Drops': 'Bajadas',
+ 'Weight drop (%)': 'Bajada de peso (%)',
+ 'Rest-pause reps': 'Repeticiones rest-pause',
+ 'Rest-pause rest': 'Descanso rest-pause',
+ 'Every set becomes a drop-set: after the main set, {0} drop(s) with no rest, each about {1}% lighter.': 'Cada serie se convierte en una serie descendente: tras la serie principal, {0} bajada(s) sin descanso, cada una un {1}% más ligera aprox.',
+ 'Every set becomes rest-pause: {0} reps to start, then {1} more split into short bursts, {2}s rest before each, roughly halving each time.': 'Cada serie se convierte en rest-pause: {0} reps para empezar, y {1} más repartidas en ráfagas cortas, con {2}s de descanso antes de cada una, bajando aprox. a la mitad cada vez.',
'Cardio logged': 'Cardio registrado',
'Discard workout?': '¿Descartar entrenamiento?',
'The sets you logged in this session will be lost.': 'Las series registradas en esta sesión se perderán.',
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index d0f6d3622..f49140afa 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -3,7 +3,7 @@ import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf, smOf } from './lib/exercises.js'
import { fmtDate, fmtNum, fmtVol, fmtDur, durPart, todayISO, uid, exCount, DAYN, MONTHS_LONG, ACCENTS } from './lib/format.js'
-import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, isBw, isPerSide, sideReps, workSetsDone } from './lib/history.js'
+import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan } from './lib/history.js'
import { beep, vibrate } from './lib/sound.js'
import { t, instrFor, getLang, INSTR_LANGS } from './lib/i18n.js'
import { nav } from './lib/nav.js'
@@ -527,6 +527,9 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
if (policyFor({ ...c, id: ex.id }, routine, 'reps') === 'double') out.repsMin = Math.min(reps, Math.max(1, Math.round(c.repsMin) || Math.max(1, reps - 2)))
// A ceiling below the working reps would tell you to add a set on day one.
if (bw && !(out.weight > 0) && c.repsMax > 0) out.repsMax = Math.max(reps, Math.round(c.repsMax))
+ // Every set in this exercise becomes a drop-set/rest-pause (buildSets stamps the rows) —
+ // decided here, in the plan, not re-decided live each time you train it.
+ if (c.intensifier && c.intensifier.type) out.intensifier = c.intensifier
onSave(out)
}
}
@@ -552,13 +555,19 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
<Stepper label={t('Seconds')} value={c.sec} step={5} decimal={false} onChange={v => setC(x => ({ ...x, sec: v }))} />
<Stepper label={t('Weight ({0})', st.unit)} value={c.weight} step={2.5} onChange={v => setC(x => ({ ...x, weight: v }))} />
</> : <>
- <Stepper label={t('Sets')} value={c.sets} step={1} decimal={false} onChange={v => setC(x => ({ ...x, sets: v }))} />
+ {/* Rest-pause always trains as exactly two rows — a warm-up at this rep count, then one
+ rest-pause work set — so "Sets" has nothing left to mean and only invites a mismatch. */}
+ {c.intensifier?.type !== 'restpause' &&
+ <Stepper label={t('Sets')} value={c.sets} step={1} decimal={false} onChange={v => setC(x => ({ ...x, sets: v }))} />}
<Stepper label={t('Reps')} value={c.reps} step={perSide ? 2 : 1} decimal={false} onChange={v => setC(x => ({ ...x, reps: v }))} />
{/* On bodyweight work the weight stepper is the click #32 is about, so it is not here
until there is a belt to describe — see the added-weight row below. */}
{!bw && <Stepper label={t('Weight ({0})', st.unit)} value={c.weight} step={2.5} onChange={v => setC(x => ({ ...x, weight: v }))} />}
</>}
</div>
+ {c.intensifier?.type === 'restpause' && <div className="small dim" style={{ marginTop: -10, marginBottom: 18 }}>
+ {t('Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.')}
+ </div>}
{mode === 'time' && !bw && <div className="small dim" style={{ marginBottom: 18 }}>
{t('A timer runs while you hold the set. Leave the weight at 0 for bodyweight holds.')}
</div>}
@@ -597,6 +606,43 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
? t('Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.', c.repsMax, MAX_BW_SETS)
: t('Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.')}
</div>}
+ {mode === 'reps' && <>
+ <h4 className="sec">{t('Drop-set / rest-pause')}</h4>
+ <div className="sect-b" style={{ marginBottom: 8 }}>
+ <SelectRow title={t('Intensifier')} sheetTitle={t('Intensifier')} value={c.intensifier?.type || ''}
+ onChange={v => setC(x => ({
+ ...x,
+ intensifier: !v ? undefined : v === 'dropset'
+ ? { type: 'dropset', count: x.intensifier?.count || 1, pct: x.intensifier?.pct || 20 }
+ // The activation set's own reps are whatever "Reps" above already says — a
+ // rest-pause plan only adds two new numbers: the total extra reps wanted past
+ // it, and the rest between the bursts that total gets split into.
+ : { type: 'restpause', totalReps: x.intensifier?.totalReps || x.reps || 8, restSec: x.intensifier?.restSec || st.restPauseSec || 15 },
+ }))}
+ options={[
+ { value: '', label: t('None') },
+ { value: 'dropset', label: t('Drop-set') },
+ { value: 'restpause', label: t('Rest-pause') },
+ ]} />
+ </div>
+ {c.intensifier?.type === 'dropset' && <div className="row cfgrow" style={{ marginBottom: 8 }}>
+ <Stepper label={t('Drops')} value={c.intensifier.count} step={1} decimal={false}
+ onChange={v => setC(x => ({ ...x, intensifier: { ...x.intensifier, count: Math.max(1, v) } }))} />
+ <Stepper label={t('Weight drop (%)')} value={c.intensifier.pct} step={5} decimal={false}
+ onChange={v => setC(x => ({ ...x, intensifier: { ...x.intensifier, pct: Math.max(5, v) } }))} />
+ </div>}
+ {c.intensifier?.type === 'restpause' && <div className="row cfgrow" style={{ marginBottom: 8 }}>
+ <Stepper label={t('Rest-pause reps')} value={c.intensifier.totalReps} step={1} decimal={false}
+ onChange={v => setC(x => ({ ...x, intensifier: { ...x.intensifier, totalReps: Math.max(1, v) } }))} />
+ <Stepper label={t('Rest (s)')} value={c.intensifier.restSec} step={5} decimal={false}
+ onChange={v => setC(x => ({ ...x, intensifier: { ...x.intensifier, restSec: Math.max(5, v) } }))} />
+ </div>}
+ {c.intensifier?.type && <div className="small dim" style={{ marginTop: -2, marginBottom: 18 }}>
+ {c.intensifier.type === 'dropset'
+ ? t('Every set becomes a drop-set: after the main set, {0} drop(s) with no rest, each about {1}% lighter.', c.intensifier.count, c.intensifier.pct)
+ : t('Every set becomes rest-pause: {0} reps to start, then {1} more split into short bursts, {2}s rest before each, roughly halving each time.', c.reps || 0, c.intensifier.totalReps, c.intensifier.restSec)}
+ </div>}
+ </>}
<ProgressionFields ex={ex} mode={mode} c={c} setC={setC} routine={routine} unit={st.unit} />
<Button variant="primary" onClick={save}>{existing ? t('Save') : t('Add to routine')}</Button>
{ex.custom && <><div style={{ height: 8 }} /><Button icon="pencil" onClick={() => { close(); customExSheet(ex) }}>{t('Edit or delete this exercise')}</Button></>}
@@ -838,7 +884,8 @@ export function beginWorkout(routineId, bw) {
// kept on the entry purely so the workout can explain the number it chose.
const entries = (r ? r.ex : []).map(cfg => {
const plan = nextPrescription(st, cfg, r)
- return { id: cfg.id, sg: cfg.sg, target: { ...cfg }, plan, sets: applyPrescription(buildSets(st, cfg), plan) }
+ const sets = applyIntensifierPlan(applyPrescription(buildSets(st, cfg), plan), cfg)
+ return { id: cfg.id, sg: cfg.sg, target: { ...cfg }, plan, sets }
})
update(s => {
s.active = { id: uid(), d: todayISO(), start: Date.now(), routineId, name: r ? r.name : t('Freestyle'), bw: bw || null, cur: 0, entries }
@@ -896,6 +943,11 @@ function TopWeight({ entryIdx, close }) {
}
export const topWeightSheet = entryIdx => ui().openSheet(close => <TopWeight entryIdx={entryIdx} close={close} />)
+/* Drop-set drops and rest-pause bursts are edited inline on the set row itself (Workout.jsx) —
+ no sheet, no timer. A planned exercise (see the "Intensifier" config below) arrives with them
+ already computed via applyIntensifierPlan; an unplanned straight set can still grow one live
+ by tapping "+ Drop"/"+ Burst", which appends with the same suggested-next-value math. */
+
// Shown when the last exercise's last set is checked — finish, or keep going.
function WorkoutComplete({ close }) {
return <div style={{ textAlign: 'center', padding: '8px 0' }}>
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index 6da600e30..96b2911aa 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -8,7 +8,7 @@ import { MOBILE, nativeLoad, nativeSave, syncReminder } from '../lib/mobile.js'
const KEY = 'gym_state_v1'
export const DEF = {
- unit: 'kg', restSec: 90, sound: true, keepAwake: true, lang: 'en',
+ unit: 'kg', restSec: 90, restPauseSec: 15, sound: true, keepAwake: true, lang: 'en',
theme: 'dark', accent: 'lime', body: 'male', targetW: null,
bodyweight: [], routines: [], week: {}, dayPlan: {},
exWeights: {}, workouts: [], active: null, customEx: [], gifSize: 'full',
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index d6d071bf8..f4d0c41a2 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -120,6 +120,12 @@ export default function Settings() {
<SelectRow icon="timer" iconTint="var(--orange)" title={t('Rest timer')}
value={S.restSec} onChange={v => update(s => { s.restSec = v })}
options={[60, 90, 120, 150, 180].map(v => ({ value: v, label: v + 's' }))} />
+ {/* Default for a rest-pause burst added live on a plain set — a planned exercise's own
+ "Rest (s)" (in its Intensifier config) overrides this, same as the main rest timer
+ is the fallback whenever an exercise has no progression rule of its own. */}
+ <SelectRow icon="bolt" iconTint="var(--acc)" title={t('Rest-pause rest')}
+ value={S.restPauseSec} onChange={v => update(s => { s.restPauseSec = v })}
+ options={[10, 15, 20, 30].map(v => ({ value: v, label: v + 's' }))} />
{(wakeOK || !MOBILE) && (
<Row icon="sun" iconTint="var(--yellow)" title={t('Keep screen awake')}
subtitle={wakeOK ? null : t('Not supported in this browser.')}>
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 7b9f61a1f..0b8eb566f 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -3,7 +3,7 @@ import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
import { exOr } from '../lib/exercises.js'
-import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, freestyleConfig, defaultConfig, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, sideReps, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg } from '../lib/history.js'
+import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, freestyleConfig, defaultConfig, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, sideReps, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan } from '../lib/history.js'
import { fmtNum, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'
import { beep, vibrate } from '../lib/sound.js'
import { t } from '../lib/i18n.js'
@@ -15,7 +15,7 @@ import Icon from '../components/Icon.jsx'
import { Button, Check, NumberField } from '../components/ui.jsx'
import { nextPrescription, applyPrescription } from '../lib/progression.js'
import { glyphOf } from '../lib/glyphs.js'
-import { isWarmupRow } from '../lib/workout-model.js'
+import { isWarmupRow, isDropSet, isRestPauseSet, dropsOf, clustersOf, addDrop, addCluster, removeDropAt, removeClusterAt, setDropAt, setClusterAt, nextDropWeight, nextBurstReps } from '../lib/workout-model.js'
/* ---------- start chooser (no active workout) ---------- */
function StartChooser() {
@@ -58,8 +58,39 @@ function Elapsed({ start }) {
/* ---------- one exercise block (reps: weight×reps · time: a held duration · cardio: duration+speed) ---------- */
function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemoveSet, onAddWarmup, onRemoveSetAt, onStartTimed, onPairPrev, onPairNext }) {
const S = useStore(s => s.S)
+ const update = useStore(s => s.update)
const working = useUI(s => s.work)
const entry = S.active.entries[entryIdx]
+ // Drops/bursts mutate the row in place — same card, not a new set with its own long rest.
+ // A planned exercise (see the exercise's "Intensifier" config) arrives with these already
+ // filled in by applyIntensifierPlan; these only add/edit/remove entries live from here on.
+ const mutSet = (i, fn) => update(s => { const row = s.active.entries[entryIdx].sets[i]; s.active.entries[entryIdx].sets[i] = fn(row) }, true)
+ const addDropRow = i => mutSet(i, row => {
+ const drops = dropsOf(row)
+ const base = drops.length ? drops[drops.length - 1].w : (row.w || 0)
+ const pct = entry.target?.intensifier?.type === 'dropset' ? entry.target.intensifier.pct : undefined
+ return addDrop(row, { w: nextDropWeight(base, pct), r: row.r })
+ })
+ // A rest-pause row's own reps are always the total across every burst (see
+ // applyIntensifierPlan/history.js) — clusters are the breakdown of that total, not extra on
+ // top of it — so adding, removing or editing one keeps `r` in step by the same delta.
+ const addBurstRow = i => mutSet(i, row => {
+ const clusters = clustersOf(row)
+ const base = clusters.length ? clusters[clusters.length - 1].r : (row.r || 0)
+ const restSec = entry.target?.intensifier?.type === 'restpause' ? entry.target.intensifier.restSec : (S.restPauseSec || 15)
+ const added = nextBurstReps(base)
+ return { ...addCluster(row, { r: added, restSec }), r: (row.r || 0) + added }
+ })
+ const removeDrop = (i, di) => mutSet(i, row => removeDropAt(row, di))
+ const removeCluster = (i, ci) => mutSet(i, row => {
+ const removed = clustersOf(row)[ci]?.r || 0
+ return { ...removeClusterAt(row, ci), r: Math.max(0, (row.r || 0) - removed) }
+ })
+ const setDropField = (i, di, field, v) => mutSet(i, row => setDropAt(row, di, { [field]: v }))
+ const setClusterField = (i, ci, v) => mutSet(i, row => {
+ const delta = (Number(v) || 0) - (clustersOf(row)[ci]?.r || 0)
+ return { ...setClusterAt(row, ci, { r: v }), r: Math.max(0, (row.r || 0) + delta) }
+ })
const ex = exOr(entry.id)
const mode = modeOf({ ...(entry.target || {}), id: entry.id })
const cardio = mode === 'cardio'
@@ -110,6 +141,15 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
<button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>
</div>
)
+ // A smaller stepper for a drop's weight/reps or a burst's reps — editing what the plan (or a
+ // live "+ Drop"/"+ Burst" tap) already put on the row, not typing into a fresh field.
+ const miniStepper = (value, step, dec, onChange) => (
+ <div className="stp mini">
+ <button aria-label="Decrease" onClick={() => onChange(Math.max(0, Math.round(((value || 0) - step) * 100) / 100))}><Icon name="minus" /></button>
+ <span className="val"><NumberField decimal={dec} value={value ?? ''} onChange={onChange} /></span>
+ <button aria-label="Increase" onClick={() => onChange(Math.max(0, Math.round(((value || 0) + step) * 100) / 100))}><Icon name="plus" /></button>
+ </div>
+ )
return <>
<Media ex={ex} key={entry.id} compact={compact} minimizable />
<div className="row between" style={{ marginBottom: 6 }}>
@@ -159,6 +199,31 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
disabled={entry.sets.length <= 1} onClick={() => onRemoveSetAt(i)}><Icon name="xmark" /></button>}
<Check checked={s.done} onChange={() => onToggle(i)} />
</div>
+ {/* Drop-sets and rest-pause bursts extend this same row — no long rest, no new set.
+ A planned exercise arrives with these already filled in (applyIntensifierPlan);
+ every value here is just as editable as the main row's own weight/reps. */}
+ {!warm && mode === 'reps' && <>
+ {dropsOf(s).map((d, di) => (
+ <div className="subrow" key={'d' + di}>
+ <span className="subn">{t('Drop {0}', di + 1)}</span>
+ {miniStepper(d.w, 2.5, true, v => setDropField(i, di, 'w', v))}
+ {miniStepper(d.r, 1, false, v => setDropField(i, di, 'r', v))}
+ <button className="iconbtn" aria-label={t('Remove drop')} onClick={() => removeDrop(i, di)}><Icon name="xmark" /></button>
+ </div>
+ ))}
+ {clustersOf(s).map((c, ci) => (
+ <div className="subrow" key={'c' + ci}>
+ <span className="subn">{t('Burst {0}', ci + 1)}</span>
+ {miniStepper(c.r, 1, false, v => setClusterField(i, ci, v))}
+ <span className="dim small">{c.restSec}s</span>
+ <button className="iconbtn" aria-label={t('Remove burst')} onClick={() => removeCluster(i, ci)}><Icon name="xmark" /></button>
+ </div>
+ ))}
+ <div className="setextra">
+ {!isRestPauseSet(s) && <button className="chip add" onClick={() => addDropRow(i)}><Icon name="arrowDown" />{t('+ Drop')}</button>}
+ {!isDropSet(s) && <button className="chip add" onClick={() => addBurstRow(i)}><Icon name="bolt" />{t('+ Burst')}</button>}
+ </div>
+ </>}
</div>
})}
<div style={{ height: 8 }} />
@@ -428,7 +493,8 @@ function ActiveWorkout() {
const full = { ...cfg, id: ex.id }
const plan = freestyle ? null : nextPrescription(s, full, s.routines.find(r => r.id === s.active.routineId))
const sets = buildSets(s, full, freestyle ? { preferLast: true } : undefined)
- s.active.entries.push({ id: ex.id, target: { ...cfg }, plan, sets: freestyle ? sets : applyPrescription(sets, plan) })
+ const progressed = freestyle ? sets : applyPrescription(sets, plan)
+ s.active.entries.push({ id: ex.id, target: { ...cfg }, plan, sets: applyIntensifierPlan(progressed, full) })
s.active.cur = s.active.entries.length - 1
}), null, routine, seed)
})} icon="plus">{t('Add exercise')}</Button>