Per side: log the total, show the split

Feedback on #31: a rep count that sometimes means one side and sometimes both is
the ambiguity, not the fix for it. So the logged number is the total — 16 — the
same as every other set in the app, and the split is derived for planning: "8 per
side" on the exercise, "3 × 16 · 8/side" on the plan line and the printed sheet.

Unilateral targets step in twos. 16 → 18 → 20, in the config stepper, the set-row
stepper and the bodyweight rep progression, because half of an odd total is a rep
one side never gets. Turning the flag on rounds an existing target up to even, and
a saved target is stored even for the same reason. An odd total that arrives some
other way still displays honestly, as 8.5 per side, since that is what it means.

Volume loses its per-side case: both sides are already in the number logged.
This commit is contained in:
Duarte Santos committed 2026-08-01 16:47:44 +02:00
1 parent c33ff15d9d
commit 4afffcb248
19 files changed
+103 -90

No files matched your search

+7 -4
View File
@@ -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, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, totalReps, EFFORT, effortOf, stepEffort, capEffort } from '../lib/history.js'
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, sideReps, repStep, EFFORT, effortOf, stepEffort, capEffort } 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'
@@ -76,7 +76,9 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
const bw = !cardio && isBw(cfg)
const added = bw && entry.sets.some(s => s.w > 0)
const loadCol = { f: 'w', step: 2.5, dec: true, hd: bw ? t('Added ({0})', S.unit) : t('Weight ({0})', S.unit) }
const repCol = { f: 'r', step: 1, dec: false, hd: isPerSide(cfg) ? t('Reps/side') : t('Reps') }
// The reps column is the total in every mode, unilateral included — the stepper walks in
// twos there so the number you land on is one you can actually split evenly.
const repCol = { f: 'r', step: repStep(cfg), dec: false, hd: t('Reps') }
const col1 = cardio ? { f: 'min', step: 1, dec: false, hd: t('Duration (min)') }
: timed ? { f: 'sec', step: 5, dec: false, hd: t('Seconds') }
: (bw && !added) ? repCol : loadCol
@@ -114,8 +116,9 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
</div>
<div className="row" style={{ gap: 6, flexWrap: 'wrap', marginBottom: 8 }}>
{cardio && <span className="tag acc"><Icon name="figureRun" />{t('Cardio')}</span>}
{/* The set rows say "8"; this is where the arithmetic fits (issue #31). */}
{isPerSide(cfg) && <span className="tag acc nocap"><Icon name="shuffle" />{t('Per side · {0} in total', totalReps(cfg, entry.sets[0]?.r) * entry.sets.length)}</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>}
{(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>}