Add optional RIR (reps in reserve) to reps-mode sets
Adds a third stepper column, next to weight and reps, for logging RIR on strength sets — not shown for cardio or timed holds, where it has no meaning. RIR is purely a logging/display addition: it never touches the progression engine (linear/Greyskull/double progression only ever read weight/reps/seconds), and it round-trips through the existing whole-object backup export/import with no code changes there. The set object only gains an `rir` key once the user actually logs a value (buildSets/addSet don't pre-seed it), matching how missing fields already read as undefined elsewhere in the store — no schema version or migration needed for existing logged workouts. Fitting a third stepper next to weight+reps on narrow phones needed the same treatment as the exercise-config sheet's three-steppers-in-a-row (.cfgrow): narrower buttons and a smaller value font just for rows that show RIR, verified by hand at 360-390px with edge-case values (2-3 digit weight, double-digit reps, decimal RIR together). "Last time" summaries now append "(RIR n)" when a set has one logged, covered by new setLabel tests including the rir: 0 case (0 is a valid RIR and must not be treated as absent).
This commit is contained in:
1 parent
ab0c98ba85
commit
6714b16e6a
4 files changed
+25
-3
No files matched your search
@@ -29,7 +29,7 @@ export function setLabel(id, s, cfg) {
|
||||
const mode = modeOf(cfg || { id })
|
||||
if (mode === 'cardio') return `${s.min || 0} min @ ${fmtNum(s.speed || 0)} km/h`
|
||||
if (mode === 'time') return fmtSec(s.sec) + (s.w > 0 ? ` · ${fmtNum(s.w)}` : '')
|
||||
return `${fmtNum(s.w || 0)}×${s.r || 0}`
|
||||
return `${fmtNum(s.w || 0)}×${s.r || 0}` + (s.rir != null ? ` (RIR ${fmtNum(s.rir)})` : '')
|
||||
}
|
||||
// Default config for a freshly added exercise.
|
||||
export function defaultConfig(id, mode) {
|
||||
|
||||
@@ -63,6 +63,12 @@ describe('setLabel', () => {
|
||||
expect(setLabel(LIFT, { w: 0, r: 0 })).toBe('0×0')
|
||||
expect(setLabel(CARDIO, {})).toBe('0 min @ 0 km/h')
|
||||
})
|
||||
|
||||
it('appends RIR when present, including a valid 0', () => {
|
||||
expect(setLabel(LIFT, { w: 60, r: 10, rir: 2 })).toBe('60×10 (RIR 2)')
|
||||
expect(setLabel(LIFT, { w: 60, r: 10, rir: 1.5 })).toBe('60×10 (RIR 1.5)')
|
||||
expect(setLabel(LIFT, { w: 60, r: 10, rir: 0 })).toBe('60×10 (RIR 0)')
|
||||
})
|
||||
})
|
||||
|
||||
describe('defaultConfig', () => {
|
||||
|
||||
Reference in new issue
Block a user