Effort stepper: count up from the bottom of the scale

The first + on an empty cell jumped straight to a "typical working set"
(RIR 2 / RPE 8), skipping 0 and 1 with no way to see why. A stepper that
lands somewhere other than where counting would take you is just puzzling,
so it now starts at the bottom of the scale and walks up in even steps like
every other stepper in the app: RIR from 0, RPE from 6 — the scale is only
meaningful for working sets and anything lighter is a warm-up nobody rates.

Stepping back off the floor clears the cell again, so a mistap is undoable
instead of sticking at 0 — which on the RIR scale claims the set went to
failure. − on a cell that was never filled in still leaves it empty.

The stepping moved out of the view into stepEffort/capEffort in history.js,
where it can be tested: 16 new cases covering the scale walk, the floor and
ceiling, the clear-on-undershoot, half-step rounding, junk settings values,
the showRir overlay every load path performs, and a session's worth of
logging end to end.

A typed value is still only capped, never floored — clamping up would turn
the "1" of "10" into the floor and fight the input.

The help sheet no longer claims the highlighted row is where + starts; it is
where working sets usually land. Reworded in all 11 language packs.
This commit is contained in:
Duarte Santos committed 2026-07-30 23:52:57 +02:00
1 parent 0c6c22c04b
commit 6905117352
15 files changed
+188 -29

No files matched your search

+3 -2
View File
@@ -185,7 +185,8 @@ const EFFORT_ROWS = [
['3', '7', 'Three more reps'],
['4+', '≤6', 'Easy — warm-up territory'],
]
// RIR 2 / RPE 8: the row a working set usually lands on, and where the first + puts you.
// RIR 2 / RPE 8: the row a working set usually lands on — the anchor the others are read
// against. Not where the stepper starts; + walks up from the bottom of the scale.
const EFFORT_TYPICAL = 2
function effortHelpSheet() {
@@ -204,7 +205,7 @@ function effortHelpSheet() {
</div>
<div className="dim small" style={{ lineHeight: 1.5, display: 'grid', gap: 8 }}>
<div>{t('RIR counts the reps you left; RPE reads the same effort off a 10-point scale — so RPE ≈ 10 − RIR. Pick the one you already think in.')}</div>
<div>{t('The highlighted row is where the first + lands. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.')}</div>
<div>{t('The highlighted row is where most working sets land. Sets you have already logged keep their own scale, and nothing else reads the value — progression and estimated 1RM are unaffected.')}</div>
</div>
<div style={{ height: 8 }} />
</>)
+10 -12
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, EFFORT, effortOf } from '../lib/history.js'
import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, 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'
@@ -78,25 +78,23 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
// Effort (RIR or RPE, whichever the profile logs) only makes sense for weighted rep sets,
// not cardio/timed holds, and is opt-in since it adds a third stepper to every row. `opt`
// because an unlogged effort is not the same as 0 — RIR 0 says the set went to failure.
const eff = EFFORT[effortOf(S)]
const col3 = mode === 'reps' && eff ? { ...eff, dec: true, opt: true, hd: t(eff.hd) } : null
// Stepping an optional field that was never filled in must not clamp to 0: one stray − on a
// fresh row would stamp "(RIR 0)" — to failure — on the set for good. − leaves it empty, and
// the first + lands on a typical working set (RIR 2 / RPE 8) rather than the end of the scale.
const kind = effortOf(S)
const eff = EFFORT[kind]
const col3 = mode === 'reps' && eff ? { ...eff, eff: kind, dec: true, opt: true, hd: t(eff.hd) } : null
// The effort column walks its own scale — see stepEffort. Weight and reps step up from 0
// with no ceiling, as they always did.
const bump = (s, i, col, dir) => {
const cur = s[col.f]
if (col.opt && cur == null) return dir < 0 ? undefined : onField(i, col.f, col.start)
const n = Math.round(((cur || 0) + dir * col.step) * 100) / 100
onField(i, col.f, Math.min(col.max ?? Infinity, Math.max(0, n)))
if (col.eff) return onField(i, col.f, stepEffort(col.eff, s[col.f], dir))
onField(i, col.f, Math.max(0, Math.round(((s[col.f] || 0) + dir * col.step) * 100) / 100))
}
// Uses the shared stepper markup so a set row picks up the same control styling
// as every other +/- field in the app.
const cell = (s, i, col, cls) => (
<div className={'stp ' + cls}>
<button aria-label="Decrease" onClick={() => bump(s, i, col, -1)}><Icon name="minus" /></button>
{/* a typed value is capped too — RPE has no 12, and 12 reps in reserve is a warm-up */}
{/* a typed effort is capped — there is no RPE 12, and 12 reps in reserve is a warm-up */}
<span className="val"><NumberField decimal={col.dec} nullable={col.opt} value={s[col.f] ?? ''}
onChange={v => onField(i, col.f, v == null || col.max == null ? v : Math.min(col.max, v))} /></span>
onChange={v => onField(i, col.f, col.eff ? capEffort(col.eff, v) : v)} /></span>
<button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>
</div>
)