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.

Per side stays on reps work, where reps exist

Duarte Santos00b4f543a38f
diff --git a/frontend/src/lib/history.test.js b/frontend/src/lib/history.test.js
index fd1133424..0117e223f 100644
--- a/frontend/src/lib/history.test.js
+++ b/frontend/src/lib/history.test.js
@@ -288,6 +288,12 @@ describe('sideReps', () => {
})
})
+describe('exLine — per side never reaches a timed hold', () => {
+ it('ignores a stale side flag on a hold, which has no reps to split', () => {
+ expect(exLine({ id: LIFT, sets: 3, sec: 45, mode: 'time', side: true }, 'kg')).toBe('3 × 0:45')
+ })
+})
+
describe('repStep', () => {
it('steps unilateral work in twos so the total stays splittable', () => {
expect(repStep({ side: true })).toBe(2)
diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js
index a09718b62..c04acd18a 100644
--- a/frontend/src/lib/plan-share.js
+++ b/frontend/src/lib/plan-share.js
@@ -36,7 +36,8 @@ function cleanEx(e) {
// How the exercise is logged travels too (issues #31/#32) — the bodyweight flag only when
// it disagrees with the catalogue, since agreeing is what the other end already assumes.
if (e.bodyweight != null && e.bodyweight !== isBodyweightEq(e.id)) o.bodyweight = e.bodyweight
- if (e.side) o.side = true
+ // Only on reps work — `side` counts reps, and a timed hold has none to split.
+ if (e.side && mode !== 'time' && mode !== 'cardio') o.side = true
// Progression settings travel with the plan — a shared Greyskull routine that arrives
// without its rule is just a list of weights.
if (e.prog) o.prog = e.prog
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 8d0ce7a5b..83bdd94fe 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -504,9 +504,11 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) {
if (c.inc > 0) prog.inc = c.inc
// Written only when it differs from what the dataset already says, so a barbell config
// stays exactly the shape it was before these flags existed.
+ // `bodyweight` is true of a hold as much as of a set of reps; `side` is not — it counts
+ // reps, and a timed hold has none. Switching an exercise to Time therefore drops it
+ // rather than carrying a flag nothing downstream can read.
const flags = {}
if (bw !== isBodyweightEq(ex.id)) flags.bodyweight = bw
- if (perSide) flags.side = true
if (cardio) onSave({ sets, min: Math.max(1, Math.round(c.min) || 20), speed: Math.max(0, c.speed || 8) })
else if (mode === 'time') onSave({ sets, mode: 'time', sec: Math.max(1, Math.round(c.sec) || 45), weight: Math.max(0, c.weight || 0), ...flags, ...prog })
else {
@@ -514,7 +516,7 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) {
// otherwise plan seven reps on one side and eight on the other, every session.
const typed = Math.max(1, Math.round(c.reps) || 10)
const reps = perSide ? Math.ceil(typed / 2) * 2 : typed
- const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...prog }
+ const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...flags, ...(perSide ? { side: true } : {}), ...prog }
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))
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index c7446bb59..3040bcc11 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -118,7 +118,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
{cardio && <span className="tag acc"><Icon name="figureRun" />{t('Cardio')}</span>}
{/* You log the total; this is the split, so the set in front of you is unambiguous
without the rep count having to mean two different things (issue #31). */}
- {isPerSide(cfg) && <span className="tag acc nocap"><Icon name="shuffle" />{t('{0} per side', fmtNum(sideReps(entry.sets.find(s => !s.done)?.r ?? entry.sets[0]?.r)))}</span>}
+ {!cardio && !timed && isPerSide(cfg) && <span className="tag acc nocap"><Icon name="shuffle" />{t('{0} per side', fmtNum(sideReps(entry.sets.find(s => !s.done)?.r ?? entry.sets[0]?.r)))}</span>}
{(ex.tg || ex.bp) && <span className="tag">{t(ex.tg || ex.bp)}</span>}
{ex.eq && <span className="tag">{t(ex.eq)}</span>}
{best > 0 && <span className="tag nocap">{t('Best:')} {fmtNum(best)} {S.unit}</span>}