Merge branch 'effort-metric': effort per set (RIR / RPE)

Adds an optional per-set effort rating on either of the two scales people
actually use, generalising the RIR column from #21 rather than bolting a
second one next to it, and teaches the importer to read the RPE that Hevy
and Strong already export.
This commit is contained in:
Duarte Santos committed 2026-07-31 00:14:51 +02:00
commit ca917f0320
20 files changed
+677 -55

No files matched your search

+44 -9
View File
@@ -236,6 +236,15 @@ h4.sec{
.lrow-c{color:var(--label);font-size:15px;flex:none;--icon-stroke:2.4}
.lrow-k{color:var(--acc);font-size:17px;flex:none;--icon-stroke:2.4}
.lrow.danger,.lrow.danger .lrow-t{color:var(--red)}
/* an (i) before a row's control: painted small and dim so the control stays the loud thing,
but with a finger-sized target like everything else — the padding is the hit area and the
vertical negative margin keeps it from making the row taller. The horizontal ones pull the
hit area back under the row's own 12px gap instead of adding to it. */
.helpbtn{
color:var(--label-3);font-size:16px;background:none;line-height:0;flex:none;
margin:-11px -2px -11px -4px;padding:11px 4px;
}
.helpbtn:active{color:var(--label)}
/* -------------------------------------------------------------- buttons -- */
.btn{
@@ -539,7 +548,7 @@ h4.sec{
.sethead .n-sp{width:24px;flex:none}
.sethead .w-sp{flex:1.4;text-align:center}
.sethead .r-sp{flex:1;text-align:center}
.sethead .rir-sp{text-align:center}
.sethead .eff-sp{text-align:center}
.sethead .ck-sp{width:30px;flex:none}
.setrow{display:flex;align-items:center;gap:8px;padding:7px 0;position:relative}
.setrow+.setrow::before{
@@ -552,20 +561,20 @@ h4.sec{
}
.setrow .stp.w{flex:1.4;min-width:0}
.setrow .stp.r{flex:1;min-width:0}
.setrow .stp.rir{flex:1.1;min-width:0}
.setrow .stp.eff{flex:1.1;min-width:0}
.setrow .stp button{width:32px;height:40px}
/* a 3rd stepper (RIR) needs narrower buttons and a tighter row gap to fit next to weight+reps
on narrow phones, same technique as the exercise-config sheet's three-steppers-in-a-row
(.cfgrow below) — RIR's own value is short ("1.5") so its buttons shrink the most, weight/reps
just enough to make room since their values ("82.5", "12") need more of what's left.
The header shares the numbers so its labels stay centred over the steppers they name. */
.setrow.rir3,.sethead.rir3{gap:6px}
.setrow.rir3 .stp.w,.sethead.rir3 .w-sp{flex:1.2}
.setrow.rir3 .stp.r,.sethead.rir3 .r-sp{flex:1}
.setrow.rir3 .stp.rir,.sethead.rir3 .rir-sp{flex:.85}
.setrow.rir3 .stp button{width:23px}
.setrow.rir3 .stp.rir button{width:20px}
.setrow.rir3 .stp .num{font-size:14px}
.setrow.eff3,.sethead.eff3{gap:6px}
.setrow.eff3 .stp.w,.sethead.eff3 .w-sp{flex:1.2}
.setrow.eff3 .stp.r,.sethead.eff3 .r-sp{flex:1}
.setrow.eff3 .stp.eff,.sethead.eff3 .eff-sp{flex:.85}
.setrow.eff3 .stp button{width:23px}
.setrow.eff3 .stp.eff button{width:20px}
.setrow.eff3 .stp .num{font-size:14px}
.setrow.done .n{background:var(--acc);color:var(--on-acc)}
.setrow.done{opacity:.45}
/* why the next target is what it is (issue #17) */
@@ -644,6 +653,32 @@ h4.sec{
:root[data-theme="light"] .center{background:#fff}
@keyframes pop{from{transform:translate(-50%,-50%) scale(.94);opacity:0}to{transform:translate(-50%,-50%) scale(1);opacity:1}}
/* --- RIR/RPE conversion table (effort help sheet) ---
The two scales only click when you see them side by side, so the numbers get fixed-width
tabular columns you can read straight down, and the words take whatever is left. Built out
of the same grouped-list parts as the rest of the app (surface fill, inset hairlines) rather
than a real <table>, so it inherits the card look and wraps properly on a narrow phone. */
.efftbl{background:var(--surface);border-radius:var(--r-lg);overflow:hidden;margin:14px 0 12px}
.efftbl .r{display:flex;align-items:center;gap:10px;padding:10px 14px;position:relative}
.efftbl .r+.r::before{
content:'';position:absolute;left:14px;right:0;top:0;height:var(--hair);background:var(--sep);
}
.efftbl .n{
width:36px;flex:none;text-align:center;font-size:17px;font-weight:600;
letter-spacing:-.02em;font-variant-numeric:tabular-nums;
}
.efftbl .f{flex:1;min-width:0;font-size:15px;color:var(--label-2);line-height:1.3}
/* the header names the columns without competing with them */
.efftbl .hd{background:var(--surface-2);padding-top:8px;padding-bottom:8px}
.efftbl .hd .n,.efftbl .hd .f{
font-size:11px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;
color:var(--label-3);
}
/* the row a working set usually lands on — the anchor the others are read against */
.efftbl .r.on{background:var(--acc-soft)}
.efftbl .r.on .n{color:var(--acc)}
.efftbl .r.on .f{color:var(--label)}
/* --- glyph picker (replaces the emoji grid) --- */
.glyph-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:9px}
.glyph-cell{
+44 -1
View File
@@ -23,13 +23,56 @@ export function fmtSec(sec) {
return Math.floor(n / 60) + ':' + String(n % 60).padStart(2, '0')
}
// How hard a set felt, if the profile logs it at all. Two scales for the same thing, kept in
// their own fields: RIR counts the reps still in the tank, RPE reads the same effort off a
// 10-point scale from the top (RPE 8 ≈ RIR 2). A set logged on one scale is never silently
// rewritten as the other — switching the setting changes what new sets ask for, nothing else.
// `min`..`max` is the range the stepper walks. RIR bottoms out at 0 (a set taken to failure);
// RPE bottoms out at 6, since the scale is only meaningful for working sets and anything
// lighter is a warm-up nobody rates.
export const EFFORT = {
rir: { f: 'rir', hd: 'RIR', step: 0.5, min: 0, max: 10 },
rpe: { f: 'rpe', hd: 'RPE', step: 0.5, min: 6, max: 10 }
}
// One tap of an effort stepper. Empty is not 0 — an unlogged effort must not become "went to
// failure" from one stray tap — so − on an empty cell leaves it empty, and + starts at the
// bottom of the scale and walks up from there in even steps. Stepping back off the bottom
// clears the cell again, so a mistap is undoable. null means "nothing logged"; the caller
// stores that by dropping the key rather than writing a null.
export function stepEffort(kind, cur, dir) {
const e = EFFORT[kind]
if (!e) return cur ?? null
if (cur == null) return dir < 0 ? null : e.min
const n = Math.round((cur + dir * e.step) * 100) / 100
if (dir < 0 && n < e.min) return null
// only the ceiling is enforced on the way up: a value typed below the floor (nothing stops
// someone entering RPE 3) still steps in even increments instead of snapping to the floor.
return dir > 0 ? Math.min(e.max, n) : Math.max(e.min, n)
}
// A typed effort is capped but not floored — clamping up while someone types "10" would turn
// the first keystroke into the floor and fight the input.
export const capEffort = (kind, v) =>
(v == null || !EFFORT[kind] ? v : Math.min(EFFORT[kind].max, v))
// Which scale a profile logs. `showRir` is the boolean this replaced and is only consulted
// when the profile has no answer of its own — an explicit 'none' has to win over it, or a
// backup or another device that still carries the old flag would switch the column back on.
export const effortOf = S => {
const e = S && S.effort
return e === 'none' || EFFORT[e] ? e : (S && S.showRir ? 'rir' : 'none')
}
// The "(RIR 2)" / "(RPE 8)" tail on a set summary, empty when nothing was logged.
const effortTail = s => {
const k = s.rir != null ? 'rir' : s.rpe != null ? 'rpe' : null
return k ? ` (${EFFORT[k].hd} ${fmtNum(s[k])})` : ''
}
// One-line summary of a logged set. `cfg` carries the mode when the caller has it (a routine
// entry or a workout entry); passing an id alone keeps the old body-part behaviour.
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}` + (s.rir != null ? ` (RIR ${fmtNum(s.rir)})` : '')
return `${fmtNum(s.w || 0)}×${s.r || 0}` + effortTail(s)
}
// Default config for a freshly added exercise.
export function defaultConfig(id, mode) {
+173 -1
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume } from './history.js'
import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume, effortOf, stepEffort, capEffort } from './history.js'
import { EXDB } from './exercises.js'
// Real ids out of the shipped catalogue, so the body-part fallback is exercised for real.
@@ -75,6 +75,178 @@ describe('setLabel', () => {
// cleared in the UI: the key is dropped, but a null must read the same as absent
expect(setLabel(LIFT, { w: 60, r: 10, rir: null })).toBe('60×10')
})
it('appends RPE for a set logged on that scale', () => {
expect(setLabel(LIFT, { w: 60, r: 10, rpe: 8 })).toBe('60×10 (RPE 8)')
expect(setLabel(LIFT, { w: 60, r: 10, rpe: 9.5 })).toBe('60×10 (RPE 9.5)')
expect(setLabel(LIFT, { w: 60, r: 10, rpe: null })).toBe('60×10')
})
it('keeps each set on the scale it was logged with', () => {
// switching the setting must not rewrite history: an old RIR set still reads as RIR
expect(setLabel(LIFT, { w: 60, r: 10, rir: 2 })).toBe('60×10 (RIR 2)')
// and a set that somehow carries both is described once, by the one it was logged with
expect(setLabel(LIFT, { w: 60, r: 10, rir: 2, rpe: 8 })).toBe('60×10 (RIR 2)')
})
})
describe('effortOf', () => {
it('reads the scale a profile logs', () => {
expect(effortOf({ effort: 'rpe' })).toBe('rpe')
expect(effortOf({ effort: 'rir' })).toBe('rir')
expect(effortOf({ effort: 'none' })).toBe('none')
expect(effortOf({})).toBe('none')
})
it('keeps the column for a profile still carrying the old showRir flag', () => {
expect(effortOf({ showRir: true })).toBe('rir')
// what a stored profile actually looks like once it is overlaid on DEF
expect(effortOf({ effort: null, showRir: true })).toBe('rir')
expect(effortOf({ effort: null })).toBe('none')
expect(effortOf({ showRir: false })).toBe('none')
// once the new setting is chosen it wins, whatever the old flag said
expect(effortOf({ showRir: true, effort: 'rpe' })).toBe('rpe')
expect(effortOf({ showRir: true, effort: 'none' })).toBe('none')
})
// The store cannot be imported here (it reaches for `navigator` at module load), so the
// overlay it performs is reproduced literally: stored profile spread over the defaults.
// DEF.effort is null precisely so this lands on the showRir fallback rather than on 'none'.
const overlay = stored => ({ unit: 'kg', effort: null, ...stored })
it('survives the overlay every load path performs', () => {
// upgrading with the column on: local state, a server pull and a restored backup all
// arrive as a stored object spread over the defaults, and all must keep the column
expect(effortOf(overlay({ showRir: true }))).toBe('rir')
expect(effortOf(overlay({ showRir: false }))).toBe('none')
// a profile predating the RIR feature entirely
expect(effortOf(overlay({}))).toBe('none')
// and one written by this version
expect(effortOf(overlay({ effort: 'rpe' }))).toBe('rpe')
// an old backup restored over a profile that had already chosen: the file wins, because
// an import replaces state wholesale rather than merging
expect(effortOf(overlay({ showRir: true, effort: undefined }))).toBe('rir')
})
it('is not fooled by a junk value', () => {
expect(effortOf({ effort: 'rpe10' })).toBe('none')
expect(effortOf({ effort: 'RIR' })).toBe('none')
expect(effortOf({ effort: 'f' })).toBe('none')
expect(effortOf(null)).toBe('none')
expect(effortOf(undefined)).toBe('none')
// a junk value with the old flag still set falls back rather than showing nothing
expect(effortOf({ effort: 'nope', showRir: true })).toBe('rir')
})
})
describe('stepEffort', () => {
it('starts at the bottom of the scale and walks up', () => {
// the first + on an empty cell lands on the lowest value, not on some "typical" middle:
// the stepper counts up from the floor the way every other stepper in the app does
expect(stepEffort('rir', null, 1)).toBe(0)
expect(stepEffort('rpe', null, 1)).toBe(6)
// and then in even steps
expect(stepEffort('rir', 0, 1)).toBe(0.5)
expect(stepEffort('rir', 0.5, 1)).toBe(1)
expect(stepEffort('rpe', 6, 1)).toBe(6.5)
})
it('leaves an untouched cell unlogged when stepped down', () => {
// one stray − on a fresh row must not stamp "(RIR 0)" — went to failure — on the set
expect(stepEffort('rir', null, -1)).toBe(null)
expect(stepEffort('rpe', null, -1)).toBe(null)
expect(stepEffort('rir', undefined, -1)).toBe(null)
})
it('clears the cell again when stepped back off the floor', () => {
// so a mistap is undoable rather than sticking at the floor for good
expect(stepEffort('rir', 0, -1)).toBe(null)
expect(stepEffort('rpe', 6, -1)).toBe(null)
// but a step that stays inside the scale is an ordinary step
expect(stepEffort('rir', 0.5, -1)).toBe(0)
expect(stepEffort('rpe', 6.5, -1)).toBe(6)
})
it('stops at the top of the scale', () => {
expect(stepEffort('rir', 9.5, 1)).toBe(10)
expect(stepEffort('rir', 10, 1)).toBe(10)
expect(stepEffort('rpe', 10, 1)).toBe(10)
})
it('keeps halves clean instead of drifting into float dust', () => {
let v = null
for (let i = 0; i < 6; i++) v = stepEffort('rpe', v, 1)
expect(v).toBe(8.5)
expect(stepEffort('rir', 0.1 + 0.2, 1)).toBe(0.8)
})
it('steps evenly from a value typed below the floor rather than snapping', () => {
// nothing stops someone typing RPE 3; the stepper must not jump them to 6 on one tap
expect(stepEffort('rpe', 3, 1)).toBe(3.5)
// stepping down out of the scale from there just clears it
expect(stepEffort('rpe', 3, -1)).toBe(null)
})
it('does nothing when the profile logs no effort at all', () => {
expect(stepEffort('none', null, 1)).toBe(null)
expect(stepEffort('none', 2, 1)).toBe(2)
expect(stepEffort(undefined, 2, -1)).toBe(2)
})
})
describe('capEffort', () => {
it('caps a typed value at the top of the scale', () => {
expect(capEffort('rir', 12)).toBe(10)
expect(capEffort('rpe', 99)).toBe(10)
expect(capEffort('rpe', 8)).toBe(8)
})
it('does not floor a typed value, so typing "10" survives its first keystroke', () => {
// clamping up would turn the "1" of "10" into 6 and fight the input
expect(capEffort('rpe', 1)).toBe(1)
expect(capEffort('rir', 0)).toBe(0)
})
it('passes an emptied field through untouched', () => {
expect(capEffort('rir', null)).toBe(null)
expect(capEffort('rpe', undefined)).toBe(undefined)
expect(capEffort('none', 12)).toBe(12)
})
})
// End-to-end on the data, not the pixels: what a set carries after the taps a real session
// makes, and what it reads back as afterwards.
describe('logging effort across a session', () => {
it('logs a working set on the chosen scale', () => {
// four + taps from empty on an RPE profile: 6, 6.5, 7, 7.5
let v = null
for (let i = 0; i < 4; i++) v = stepEffort('rpe', v, 1)
expect(setLabel(LIFT, { w: 80, r: 5, rpe: v })).toBe('80×5 (RPE 7.5)')
})
it('a set taken to failure is logged, not left blank', () => {
const v = stepEffort('rir', null, 1) // one + on an RIR profile
expect(v).toBe(0)
expect(setLabel(LIFT, { w: 100, r: 3, rir: v })).toBe('100×3 (RIR 0)')
})
it('switching the setting mid-history rewrites nothing', () => {
const old = { w: 60, r: 10, rir: 2 } // logged while the profile was on RIR
const fresh = { w: 60, r: 10, rpe: 8 } // logged after switching to RPE
expect(effortOf({ effort: 'rpe' })).toBe('rpe')
expect(setLabel(LIFT, old)).toBe('60×10 (RIR 2)')
expect(setLabel(LIFT, fresh)).toBe('60×10 (RPE 8)')
// turning the column off entirely hides the control but keeps both sets readable
expect(effortOf({ effort: 'none' })).toBe('none')
expect(setLabel(LIFT, old)).toBe('60×10 (RIR 2)')
})
it('never attaches effort to a mode that has no place for it', () => {
// cardio and timed sets have no third stepper, and their labels ignore the field even
// if an import or an old file put one there
expect(setLabel(CARDIO, { min: 20, speed: 9, rpe: 8 })).toBe('20 min @ 9 km/h')
expect(setLabel(LIFT, { sec: 45, rir: 2 }, { id: LIFT, mode: 'time' })).toBe('0:45')
})
})
describe('defaultConfig', () => {
+27 -2
View File
@@ -66,6 +66,10 @@ const COLUMNS = [
['weight', ['weight']],
['weightUnit', ['weight unit', 'unit']],
['reps', ['reps', 'repetitions']],
// Hevy and Strong both write an RPE per set. Nothing mainstream exports RIR, but read it
// when it is there rather than dropping the column on the floor.
['rpe', ['rpe', 'rpe rating']],
['rir', ['rir', 'reps in reserve']],
['distanceKm', ['distance km']],
['distance', ['distance']],
['distanceUnit', ['distance unit']],
@@ -226,6 +230,18 @@ const CATEGORY_BP = {
/* ----------------------------------------------------------- conversion --- */
const num = v => { const n = parseFloat(String(v ?? '').replace(',', '.')); return isFinite(n) ? n : 0 }
// An effort rating out of someone else's export. A blank cell means "not rated" and has to
// stay absent rather than becoming 0 — and 0 itself means opposite things on the two scales:
// RIR 0 is a set taken to failure and worth keeping, while RPE has no 0 (the scale is 1–10),
// so an app writing 0 for "nothing here" must not be read as an effort. Ratings above the
// scale are capped rather than dropped — the set was still rated, just written oddly.
const effortNum = (raw, zeroMeansRated) => {
const s = String(raw ?? '').trim()
if (!s) return null
const n = parseFloat(s.replace(',', '.'))
if (!isFinite(n) || n < 0 || (n === 0 && !zeroMeansRated)) return null
return Math.min(10, Math.round(n * 100) / 100)
}
const LB_TO_KG = 0.45359237
const p2 = n => String(n).padStart(2, '0')
const MON = { jan: 1, feb: 2, mar: 3, apr: 4, may: 5, jun: 6, jul: 7, aug: 8, sep: 9, oct: 10, nov: 11, dec: 12 }
@@ -288,7 +304,7 @@ export function parseWorkoutCSV(text, { unit = 'kg' } = {}) {
const byDate = new Map()
const created = new Map()
const unmatched = new Set()
let sets = 0, skipped = 0, matched = 0, warmups = 0
let sets = 0, skipped = 0, matched = 0, warmups = 0, rpeSets = 0, rirSets = 0
let sawLb = false, sawKg = false
const cell = (r, f) => (map[f] === undefined ? '' : String(r[map[f]] ?? '').trim())
@@ -343,6 +359,15 @@ export function parseWorkoutCSV(text, { unit = 'kg' } = {}) {
const set = isCardio
? { min: mins || 0, speed: mins > 0 ? Math.round(km / (mins / 60) * 10) / 10 : 0, done: true }
: { w, r: reps || 0, done: true, u: rowUnit }
// Effort rides along only where the app can show it again: a weighted rep set. A treadmill
// row with an RPE would have nowhere to put it. A set is kept on one scale, so a file
// carrying both columns is read as RIR — the same precedence setLabel reads them back with.
if (!isCardio) {
const rir = effortNum(cell(r, 'rir'), true)
const rpe = rir == null ? effortNum(cell(r, 'rpe'), false) : null
if (rir != null) { set.rir = rir; rirSets++ }
else if (rpe != null) { set.rpe = rpe; rpeSets++ }
}
let day = byDate.get(when.d)
if (!day) {
@@ -401,7 +426,7 @@ export function parseWorkoutCSV(text, { unit = 'kg' } = {}) {
matched: new Set([...resolved.values()].filter(Boolean)).size,
matchedSets: matched,
created: created.size, unmatchedNames: [...unmatched].sort(),
sets, skipped, warmups, fileUnit, mixedUnits, converted,
sets, skipped, warmups, fileUnit, mixedUnits, converted, rpeSets, rirSets,
from: dates[0] || null, to: dates[dates.length - 1] || null,
}
}
+148
View File
@@ -0,0 +1,148 @@
import { describe, it, expect } from 'vitest'
import { parseWorkoutCSV } from './import-csv.js'
import { setLabel, effortOf } from './history.js'
// Headers as the real exports write them, trimmed to the columns that matter here.
const HEVY = 'title,start_time,end_time,exercise_title,set_index,set_type,weight_kg,reps,rpe'
const STRONG = 'Date,Workout Name,Exercise Name,Set Order,Weight,Reps,Seconds,RPE'
const FITNOTES = 'Date,Exercise,Category,Weight,Reps,Distance,Distance Unit,Time'
const rows = (head, ...lines) => parseWorkoutCSV([head, ...lines].join('\n'), { unit: 'kg' })
// every set of the first workout, in file order
const setsOf = p => p.workouts.flatMap(w => w.entries.flatMap(e => e.sets))
describe('importing effort from another app', () => {
it('reads the RPE Hevy writes per set', () => {
const p = rows(HEVY,
'Push,"12 Jan 2026, 18:00","12 Jan 2026, 19:00",Bench Press (Barbell),0,normal,60,10,8',
'Push,"12 Jan 2026, 18:00","12 Jan 2026, 19:00",Bench Press (Barbell),1,normal,60,8,9.5')
expect(p.error).toBeUndefined()
expect(setsOf(p).map(s => s.rpe)).toEqual([8, 9.5])
expect(p.rpeSets).toBe(2)
expect(p.rirSets).toBe(0)
})
it('reads the RPE Strong writes per set', () => {
const p = rows(STRONG,
'2026-01-12 18:00:00,Push,Bench Press (Barbell),1,60,10,0,7.5')
expect(setsOf(p)[0].rpe).toBe(7.5)
expect(p.rpeSets).toBe(1)
})
it('reads an RIR column when a file has one', () => {
const p = rows('Date,Exercise,Weight,Reps,RIR',
'2026-01-12,Bench Press,60,10,2',
'2026-01-12,Bench Press,60,6,0') // 0 RIR is a real rating: taken to failure
expect(setsOf(p).map(s => s.rir)).toEqual([2, 0])
expect(p.rirSets).toBe(2)
expect(setsOf(p).every(s => s.rpe === undefined)).toBe(true)
})
it('treats a blank rating as not rated, not as zero', () => {
const p = rows(HEVY,
'Push,"12 Jan 2026, 18:00",,Bench Press (Barbell),0,normal,60,10,',
'Push,"12 Jan 2026, 18:00",,Bench Press (Barbell),1,normal,60,10,8')
const s = setsOf(p)
expect('rpe' in s[0]).toBe(false) // the key is absent, so the set reads as unrated
expect(s[1].rpe).toBe(8)
expect(p.rpeSets).toBe(1)
})
it('does not read a written-out 0 as an RPE', () => {
// RPE runs 1–10, so a 0 in that column is an app saying "nothing here". Reading it as a
// rating would stamp an effort on every unrated set in the file.
const p = rows(STRONG, '2026-01-12 18:00:00,Push,Bench Press (Barbell),1,60,10,0,0')
expect('rpe' in setsOf(p)[0]).toBe(false)
expect(p.rpeSets).toBe(0)
})
it('caps a rating that overruns the scale instead of dropping the set', () => {
const p = rows(STRONG, '2026-01-12 18:00:00,Push,Bench Press (Barbell),1,60,10,0,12')
expect(setsOf(p)[0].rpe).toBe(10)
})
it('ignores junk in the rating column', () => {
const p = rows(STRONG,
'2026-01-12 18:00:00,Push,Bench Press (Barbell),1,60,10,0,hard',
'2026-01-12 18:00:00,Push,Bench Press (Barbell),2,60,10,0,-3')
expect(setsOf(p).every(s => !('rpe' in s))).toBe(true)
expect(p.rpeSets).toBe(0)
expect(p.sets).toBe(2) // the sets still import, just unrated
})
it('keeps one scale per set when a file carries both columns', () => {
const p = rows('Date,Exercise,Weight,Reps,RPE,RIR',
'2026-01-12,Bench Press,60,10,8,2')
const s = setsOf(p)[0]
expect(s.rir).toBe(2)
expect('rpe' in s).toBe(false)
// and it reads back on the scale it was stored with
expect(setLabel('0025', s)).toBe('60×10 (RIR 2)')
})
it('puts no effort on a cardio row', () => {
// a treadmill row has no third stepper to show it in
const p = rows('Date,Exercise,Distance,Distance Unit,Time,RPE',
'2026-01-12,Running,5,km,00:30:00,7')
const s = setsOf(p)[0]
expect(s.min).toBe(30)
expect('rpe' in s).toBe(false)
expect(p.rpeSets).toBe(0)
})
it('leaves a file without any rating column exactly as it was', () => {
const p = rows(FITNOTES, '2026-01-12,Bench Press,Chest,60,10,,,')
const s = setsOf(p)[0]
expect(s).toEqual({ w: 60, r: 10, done: true })
expect(p.rpeSets + p.rirSets).toBe(0)
})
it('carries the rating through the unit conversion', () => {
// lb -> kg rewrites the weight; the rating must survive that pass untouched
const p = parseWorkoutCSV([
'Date,Exercise,Weight,Weight Unit,Reps,RPE',
'2026-01-12,Bench Press,135,lbs,10,8',
].join('\n'), { unit: 'kg' })
const s = setsOf(p)[0]
expect(s.w).toBe(61.2)
expect(s.rpe).toBe(8)
expect('u' in s).toBe(false) // the row's unit marker never reaches the set
})
})
// The backup is the whole state serialised, so effort travels with it by construction. This
// pins that it stays true — a set losing its rating on a backup round trip would be silent.
describe('effort in a backup', () => {
// what Settings does on import: the file spread over the defaults. DEF cannot be imported
// here (the store reaches for `navigator` at load), so its shape is reproduced literally.
const DEF_LIKE = { unit: 'kg', workouts: [], routines: [], effort: null }
const roundTrip = S => Object.assign({ ...DEF_LIKE }, JSON.parse(JSON.stringify(S)))
it('exports and re-imports both scales and the setting', () => {
const S = {
unit: 'kg', effort: 'rpe', routines: [],
workouts: [{
d: '2026-01-12', entries: [{ id: '0025', sets: [
{ w: 60, r: 10, rpe: 8, done: true },
{ w: 60, r: 8, rir: 1, done: true },
{ w: 60, r: 12, done: true },
] }],
}],
}
const back = roundTrip(S)
expect(effortOf(back)).toBe('rpe')
const [a, b, c] = back.workouts[0].entries[0].sets
expect(a.rpe).toBe(8)
expect(b.rir).toBe(1)
expect('rpe' in c || 'rir' in c).toBe(false)
expect(setLabel('0025', a)).toBe('60×10 (RPE 8)')
expect(setLabel('0025', b)).toBe('60×8 (RIR 1)')
expect(setLabel('0025', c)).toBe('60×12')
})
it('restores a backup written before the setting existed', () => {
// the old flag survives the round trip and still decides the column
expect(effortOf(roundTrip({ showRir: true, workouts: [], routines: [] }))).toBe('rir')
expect(effortOf(roundTrip({ workouts: [], routines: [] }))).toBe('none')
})
})
+15 -2
View File
@@ -512,7 +512,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'Körpergewicht — letztes Mal jede Wiederholung, also diesmal {0} anpeilen.',
'Bodyweight — same target again until every set is clean.': 'Körpergewicht — dieselbe Vorgabe, bis jeder Satz sauber sitzt.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} Sätze bringen ein {1} mit — schalte in den Einstellungen „Anstrengung pro Satz“ ein, um es zu sehen.',
'{0} sets bring an {1} with them.': '{0} Sätze bringen ein {1} mit.',
'RIR': 'RIR',
'Show RIR column': 'RIR-Spalte anzeigen',
'RPE': 'RPE',
'Effort per set': 'Anstrengung pro Satz',
'What are RIR and RPE?': 'Was sind RIR und RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Wie schwer ein Satz war, direkt neben Gewicht und Wiederholungen. Zwei Skalen für dieselbe Einschätzung, von entgegengesetzten Enden gezählt.',
'How it felt': 'Wie es sich anfühlte',
'Nothing left — went to failure': 'Nichts mehr übrig — bis zum Muskelversagen',
'One more rep in the tank': 'Eine Wiederholung wäre noch gegangen',
'Two more reps': 'Zwei Wiederholungen übrig',
'Three more reps': 'Drei Wiederholungen übrig',
'Easy — warm-up territory': 'Locker — Aufwärmbereich',
'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.': 'RIR zählt die Wiederholungen, die du übrig lässt; RPE liest dieselbe Anstrengung auf einer 10er-Skala ab — also RPE ≈ 10 − RIR. Nimm die Skala, in der du ohnehin denkst.',
'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.': 'Die hervorgehobene Zeile ist der Bereich, in dem die meisten Arbeitssätze landen. Bereits protokollierte Sätze behalten ihre eigene Skala, und sonst liest den Wert nichts — Progression und geschätztes 1RM bleiben unberührt.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'Peso corporal: la última vez todas las repeticiones, así que ve a por {0} esta vez.',
'Bodyweight — same target again until every set is clean.': 'Peso corporal: el mismo objetivo hasta que todas las series salgan limpias.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} series traen un {1} — activa «Esfuerzo por serie» en Ajustes para verlo.',
'{0} sets bring an {1} with them.': '{0} series traen un {1}.',
'RIR': 'RIR',
'Show RIR column': 'Mostrar columna de RIR',
'RPE': 'RPE',
'Effort per set': 'Esfuerzo por serie',
'What are RIR and RPE?': '¿Qué son RIR y RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Lo dura que fue una serie, junto al peso y las repeticiones. Dos escalas para lo mismo, contadas desde extremos opuestos.',
'How it felt': 'Cómo se sintió',
'Nothing left — went to failure': 'Nada más — hasta el fallo',
'One more rep in the tank': 'Una repetición más en reserva',
'Two more reps': 'Dos repeticiones más',
'Three more reps': 'Tres repeticiones más',
'Easy — warm-up territory': 'Fácil — zona de calentamiento',
'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.': 'El RIR cuenta las repeticiones que dejas; el RPE lee ese mismo esfuerzo en una escala de 10 — así que RPE ≈ 10 − RIR. Elige la que ya usas para pensar.',
'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.': 'La fila resaltada es donde cae la mayoría de las series efectivas. Las series ya registradas conservan su escala, y nada más lee el valor: la progresión y el 1RM estimado no cambian.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'Poids du corps — toutes les répétitions la dernière fois, alors vise {0} cette fois.',
'Bodyweight — same target again until every set is clean.': 'Poids du corps — même objectif jusqu’à ce que chaque série soit propre.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} séries arrivent avec un {1} — active « Effort par série » dans les réglages pour le voir.',
'{0} sets bring an {1} with them.': '{0} séries arrivent avec un {1}.',
'RIR': 'RIR',
'Show RIR column': 'Afficher la colonne RIR',
'RPE': 'RPE',
'Effort per set': 'Effort par série',
'What are RIR and RPE?': 'Que sont le RIR et le RPE ?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'La difficulté d’une série, à côté du poids et des répétitions. Deux échelles pour la même appréciation, comptées par les deux bouts.',
'How it felt': 'La sensation',
'Nothing left — went to failure': 'Plus rien — jusqu’à l’échec',
'One more rep in the tank': 'Encore une répétition en réserve',
'Two more reps': 'Encore deux répétitions',
'Three more reps': 'Encore trois répétitions',
'Easy — warm-up territory': 'Facile — zone d’échauffement',
'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.': 'Le RIR compte les répétitions qu’il te restait ; le RPE lit le même effort sur une échelle de 10 — donc RPE ≈ 10 − RIR. Prends celle dans laquelle tu penses déjà.',
'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.': 'La ligne mise en avant est celle où tombent la plupart des séries de travail. Les séries déjà enregistrées gardent leur échelle, et rien d’autre ne lit la valeur — la progression et le 1RM estimé ne changent pas.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'बॉडीवेट — पिछली बार सारे रेप्स, तो इस बार {0} का लक्ष्य रखें।',
'Bodyweight — same target again until every set is clean.': 'बॉडीवेट — जब तक हर सेट साफ़ न हो, वही लक्ष्य।',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} सेट अपने साथ {1} लाते हैं — इसे देखने के लिए सेटिंग्स में “प्रति सेट मेहनत” चालू करें।',
'{0} sets bring an {1} with them.': '{0} सेट अपने साथ {1} लाते हैं।',
'RIR': 'RIR',
'Show RIR column': 'RIR कॉलम दिखाएं',
'RPE': 'RPE',
'Effort per set': 'हर सेट की मेहनत',
'What are RIR and RPE?': 'RIR और RPE क्या हैं?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'सेट कितना भारी था, वज़न और रेप्स के बगल में दर्ज। एक ही आकलन के लिए दो पैमाने, उलटे सिरों से गिने हुए।',
'How it felt': 'कैसा लगा',
'Nothing left — went to failure': 'कुछ नहीं बचा — फेलियर तक',
'One more rep in the tank': 'एक रेप और बाकी था',
'Two more reps': 'दो रेप और बाकी',
'Three more reps': 'तीन रेप और बाकी',
'Easy — warm-up territory': 'आसान — वॉर्म-अप का दायरा',
'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.': 'RIR बचे हुए रेप्स गिनता है; RPE उसी मेहनत को 10 के पैमाने पर पढ़ता है — यानी RPE ≈ 10 − RIR. वही चुनें जिसमें आप पहले से सोचते हैं।',
'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.': 'हाइलाइट की गई पंक्ति वह है जहाँ ज़्यादातर वर्किंग सेट आते हैं। पहले दर्ज किए सेट अपना पैमाना बनाए रखते हैं, और इस मान को और कुछ नहीं पढ़ता — प्रोग्रेशन और अनुमानित 1RM अछूते रहते हैं।',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'Corpo libero — l’ultima volta tutte le ripetizioni, quindi punta a {0} stavolta.',
'Bodyweight — same target again until every set is clean.': 'Corpo libero — stesso obiettivo finché ogni serie non è pulita.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} serie portano con sé un {1} — attiva «Sforzo per serie» nelle impostazioni per vederlo.',
'{0} sets bring an {1} with them.': '{0} serie portano con sé un {1}.',
'RIR': 'RIR',
'Show RIR column': 'Mostra colonna RIR',
'RPE': 'RPE',
'Effort per set': 'Sforzo per serie',
'What are RIR and RPE?': 'Che cosa sono RIR e RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Quanto è stata dura una serie, accanto a peso e ripetizioni. Due scale per lo stesso giudizio, contate dai lati opposti.',
'How it felt': 'Come è andata',
'Nothing left — went to failure': 'Niente più — fino a cedimento',
'One more rep in the tank': 'Un’altra ripetizione in canna',
'Two more reps': 'Altre due ripetizioni',
'Three more reps': 'Altre tre ripetizioni',
'Easy — warm-up territory': 'Facile — zona riscaldamento',
'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.': 'Il RIR conta le ripetizioni che ti restavano; l’RPE legge lo stesso sforzo su una scala da 10 — quindi RPE ≈ 10 − RIR. Scegli quella con cui già ragioni.',
'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.': 'La riga evidenziata è dove finisce la maggior parte delle serie di lavoro. Le serie già registrate mantengono la loro scala, e nient’altro legge il valore: progressione e 1RM stimato non cambiano.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': '맨몸 운동 — 지난번 전 세트 완수, 이번엔 {0}회를 노려보세요.',
'Bodyweight — same target again until every set is clean.': '맨몸 운동 — 모든 세트가 깔끔해질 때까지 같은 목표로.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0}개 세트에 {1}이(가) 함께 들어 있습니다 — 설정에서 ‘세트당 강도’를 켜면 보입니다.',
'{0} sets bring an {1} with them.': '{0}개 세트에 {1}이(가) 함께 들어 있습니다.',
'RIR': 'RIR',
'Show RIR column': 'RIR 열 표시',
'RPE': 'RPE',
'Effort per set': '세트당 강도',
'What are RIR and RPE?': 'RIR과 RPE란?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': '세트가 얼마나 힘들었는지를 무게·횟수 옆에 함께 기록합니다. 같은 판단을 양쪽 끝에서 세는 두 가지 척도입니다.',
'How it felt': '느낌',
'Nothing left — went to failure': '더는 못 함 — 실패 지점까지',
'One more rep in the tank': '한 개 더 남았음',
'Two more reps': '두 개 더 남았음',
'Three more reps': '세 개 더 남았음',
'Easy — warm-up territory': '가벼움 — 웜업 구간',
'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.': 'RIR은 남긴 횟수를 세고, RPE는 같은 노력을 10점 척도로 읽습니다 — 즉 RPE ≈ 10 − RIR. 평소에 쓰던 쪽을 고르세요.',
'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.': '강조된 줄은 대부분의 본세트가 들어가는 구간입니다. 이미 기록한 세트는 원래 척도를 그대로 유지하며, 이 값을 읽는 곳은 없습니다 — 프로그레션과 예상 1RM은 영향을 받지 않습니다.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'Masa własna — ostatnio wszystkie powtórzenia, więc tym razem celuj w {0}.',
'Bodyweight — same target again until every set is clean.': 'Masa własna — ten sam cel, dopóki każda seria nie będzie czysta.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} serii ma zapisane {1} — włącz „Wysiłek w serii” w ustawieniach, aby to zobaczyć.',
'{0} sets bring an {1} with them.': '{0} serii ma zapisane {1}.',
'RIR': 'RIR',
'Show RIR column': 'Pokaż kolumnę RIR',
'RPE': 'RPE',
'Effort per set': 'Wysiłek na serię',
'What are RIR and RPE?': 'Czym są RIR i RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Jak ciężka była seria, zapisane obok ciężaru i powtórzeń. Dwie skale tej samej oceny, liczone z przeciwnych stron.',
'How it felt': 'Jak to było',
'Nothing left — went to failure': 'Nic nie zostało — do upadku',
'One more rep in the tank': 'Jeszcze jedno powtórzenie w zapasie',
'Two more reps': 'Jeszcze dwa powtórzenia',
'Three more reps': 'Jeszcze trzy powtórzenia',
'Easy — warm-up territory': 'Lekko — poziom rozgrzewki',
'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.': 'RIR liczy powtórzenia, które zostały w zapasie; RPE odczytuje ten sam wysiłek w skali 10 — czyli RPE ≈ 10 − RIR. Wybierz tę, w której już myślisz.',
'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.': 'Wyróżniony wiersz to miejsce, w które trafia większość serii roboczych. Zapisane wcześniej serie zachowują swoją skalę, a wartości nic więcej nie czyta — progresja i szacowany 1RM pozostają bez zmian.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'Peso do corpo — da última vez todas as repetições, por isso vai a {0} desta vez.',
'Bodyweight — same target again until every set is clean.': 'Peso do corpo — o mesmo objetivo até todas as séries saírem limpas.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} séries trazem um {1} — liga «Esforço por série» nas definições para o veres.',
'{0} sets bring an {1} with them.': '{0} séries trazem um {1}.',
'RIR': 'RIR',
'Show RIR column': 'Mostrar coluna de RIR',
'RPE': 'RPE',
'Effort per set': 'Esforço por série',
'What are RIR and RPE?': 'O que são RIR e RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'O quão dura foi uma série, ao lado do peso e das repetições. Duas escalas para o mesmo juízo, contadas de pontas opostas.',
'How it felt': 'Como se sentiu',
'Nothing left — went to failure': 'Não sobrou nada — até à falha',
'One more rep in the tank': 'Mais uma repetição de margem',
'Two more reps': 'Mais duas repetições',
'Three more reps': 'Mais três repetições',
'Easy — warm-up territory': 'Fácil — zona de aquecimento',
'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.': 'O RIR conta as repetições que deixaste; o RPE lê o mesmo esforço numa escala de 10 — ou seja, RPE ≈ 10 − RIR. Escolhe aquela em que já pensas.',
'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.': 'A linha destacada é onde cai a maioria das séries de trabalho. As séries já registadas mantêm a sua escala, e mais nada lê o valor — a progressão e o 1RM estimado não mudam.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'Собственный вес — в прошлый раз все повторения, так что в этот раз целься на {0}.',
'Bodyweight — same target again until every set is clean.': 'Собственный вес — та же цель, пока все подходы не станут чистыми.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} подходов несут с собой {1} — включите «Усилие в подходе» в настройках, чтобы увидеть.',
'{0} sets bring an {1} with them.': '{0} подходов несут с собой {1}.',
'RIR': 'RIR',
'Show RIR column': 'Показывать столбец RIR',
'RPE': 'RPE',
'Effort per set': 'Усилие в подходе',
'What are RIR and RPE?': 'Что такое RIR и RPE?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Насколько тяжёлым был подход — рядом с весом и повторениями. Две шкалы для одной и той же оценки, отсчитанные с разных концов.',
'How it felt': 'Ощущения',
'Nothing left — went to failure': 'Ничего не осталось — до отказа',
'One more rep in the tank': 'Ещё одно повторение в запасе',
'Two more reps': 'Ещё два повторения',
'Three more reps': 'Ещё три повторения',
'Easy — warm-up territory': 'Легко — разминочная зона',
'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.': 'RIR считает повторения, оставшиеся в запасе; RPE читает то же усилие по 10-балльной шкале — то есть RPE ≈ 10 − RIR. Выберите ту, в которой вы уже думаете.',
'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.': 'Выделенная строка — это диапазон, в который попадает большинство рабочих подходов. Уже записанные подходы сохраняют свою шкалу, и больше это значение нигде не используется: прогрессия и расчётный 1ПМ не меняются.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': 'Vücut ağırlığı — geçen sefer bütün tekrarlar tamamdı, bu sefer {0} hedefle.',
'Bodyweight — same target again until every set is clean.': 'Vücut ağırlığı — her set temiz çıkana kadar aynı hedef.',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} set beraberinde bir {1} getiriyor — görmek için Ayarlar’da «Set başına efor» seçeneğini aç.',
'{0} sets bring an {1} with them.': '{0} set beraberinde bir {1} getiriyor.',
'RIR': 'RIR',
'Show RIR column': 'RIR sütununu göster',
'RPE': 'RPE',
'Effort per set': 'Set başına zorluk',
'What are RIR and RPE?': 'RIR ve RPE nedir?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': 'Bir setin ne kadar zor geçtiği, ağırlık ve tekrarların yanında. Aynı değerlendirme için iki ölçek, ters uçlardan sayılıyor.',
'How it felt': 'Nasıl hissettirdi',
'Nothing left — went to failure': 'Hiç kalmadı — tükenmeye kadar',
'One more rep in the tank': 'Bir tekrar daha vardı',
'Two more reps': 'İki tekrar daha vardı',
'Three more reps': 'Üç tekrar daha vardı',
'Easy — warm-up territory': 'Kolay — ısınma bölgesi',
'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.': 'RIR yedekte bıraktığın tekrarları sayar; RPE aynı eforu 10’luk ölçekte okur — yani RPE ≈ 10 − RIR. Zaten hangisiyle düşünüyorsan onu seç.',
'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.': 'Vurgulanan satır, çalışma setlerinin çoğunun denk geldiği yerdir. Daha önce kaydettiğin setler kendi ölçeğini korur ve bu değeri başka hiçbir şey okumaz — ilerleme ve tahmini 1RM etkilenmez.',
}
+15 -2
View File
@@ -494,7 +494,20 @@ export default {
'Bodyweight — every rep last time, so go for {0} this time.': '徒手动作——上次全部完成,这次冲 {0} 次。',
'Bodyweight — same target again until every set is clean.': '徒手动作——保持同样的目标,直到每组都做干净。',
// --- RIR (reps in reserve) ---
// --- effort per set (RIR / RPE) ---
'{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.': '{0} 组自带 {1}——在设置中打开“每组强度”即可看到。',
'{0} sets bring an {1} with them.': '{0} 组自带 {1}。',
'RIR': 'RIR',
'Show RIR column': '显示RIR列',
'RPE': 'RPE',
'Effort per set': '每组强度',
'What are RIR and RPE?': 'RIR 和 RPE 是什么?',
'How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.': '记录这一组有多吃力,就写在重量和次数旁边。同一个判断的两种标度,只是从相反的一端开始数。',
'How it felt': '感受',
'Nothing left — went to failure': '一点不剩——做到力竭',
'One more rep in the tank': '还能再做一次',
'Two more reps': '还能再做两次',
'Three more reps': '还能再做三次',
'Easy — warm-up territory': '轻松——热身区间',
'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.': 'RIR 数的是你还留了几次;RPE 把同样的吃力程度换成 10 分制来读——所以 RPE ≈ 10 − RIR。选你习惯的那一种。',
'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.': '高亮那一行是大多数正式组落在的位置。已经记录的组保留原来的标度,而且这个值不会被别处读取——进阶计划和预估 1RM 都不受影响。',
}
+9 -1
View File
@@ -3,7 +3,7 @@ import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
import { EXDB, EXIDX, BODYPARTS, isCardio, allExercises, equipmentOf } 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 } from './lib/history.js'
import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf } 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'
@@ -181,6 +181,14 @@ function ImportSummary({ parsed, close }) {
{have > 0 && <div className="small dim" style={{ marginBottom: 10 }}>
{t('{0} days already have data here and will be left alone.', have)}
</div>}
{/* The file rated its sets. Say so: the column is off by default, so the ratings would
otherwise arrive invisibly and look like they had been dropped. */}
{!isBW && (parsed.rirSets + parsed.rpeSets) > 0 && <div className="small dim" style={{ marginBottom: 10 }}>
{t(effortOf(st) === 'none'
? '{0} sets bring an {1} with them — switch on Effort per set in Settings to see it.'
: '{0} sets bring an {1} with them.',
parsed.rirSets || parsed.rpeSets, parsed.rirSets ? 'RIR' : 'RPE')}
</div>}
{!isBW && parsed.unmatchedNames.length > 0 && <>
<h4 className="sec">{t('Not in the library — added as your own exercises')}</h4>
<div className="mchips" style={{ marginBottom: 12 }}>
+5 -1
View File
@@ -11,7 +11,11 @@ export const DEF = {
theme: 'dark', accent: 'lime', body: 'male', targetW: null,
bodyweight: [], routines: [], week: {}, dayPlan: {},
exWeights: {}, workouts: [], active: null, customEx: [], gifSize: 'full',
reminder: { on: false, time: '08:00', tz: null }, showRir: false
// effort: which per-set effort scale is logged — 'none' | 'rir' | 'rpe'. null, not 'none', so
// that a profile which never chose (loaded state is overlaid on DEF, on every path: local,
// server pull, backup import) still falls back to the `showRir` boolean this replaced and
// keeps the column it had. See effortOf.
reminder: { on: false, time: '08:00', tz: null }, effort: null
}
const clone = o => JSON.parse(JSON.stringify(o))
+44 -2
View File
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom'
import { useStore, DEF, hasData } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
import { ACCENTS, todayISO, localTZ } from '../lib/format.js'
import { effortOf } from '../lib/history.js'
import { webauthnOK, passkeyLogin, passkeyRegister, IS_ANDROID } from '../lib/api.js'
import { pushSupported, enablePush, disablePush, sendTestPush } from '../lib/push.js'
import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
@@ -133,8 +134,13 @@ export default function Settings() {
<Row icon="bell" iconTint="var(--pink)" title={t('Sounds')}>
<Switch checked={!!S.sound} onChange={v => update(s => { s.sound = v })} />
</Row>
<Row icon="target" iconTint="var(--purple)" title={t('Show RIR column')}>
<Switch checked={!!S.showRir} onChange={v => update(s => { s.showRir = v })} />
{/* Two names for the same judgement, so the column asks in the scale you already think in.
The (i) sits before the control — you read it on the way to the choice, not after it. */}
<Row icon="target" iconTint="var(--purple)" title={t('Effort per set')}>
<button className="helpbtn" aria-label={t('What are RIR and RPE?')} onClick={effortHelpSheet}><Icon name="info" /></button>
<Segmented className="seg-inline"
options={[{ value: 'none', label: t('Off') }, { value: 'rir', label: t('RIR') }, { value: 'rpe', label: t('RPE') }]}
value={effortOf(S)} onChange={v => update(s => { s.effort = v; delete s.showRir })} />
</Row>
</Section>
@@ -169,6 +175,42 @@ export default function Settings() {
</div>
}
// The whole point is that the two scales are one judgement counted from opposite ends, and a
// paragraph is a bad way to say that — the conversion table shows it in one look. Reading down
// a column is the answer to "what do I put here", so the numbers get their own aligned columns.
const EFFORT_ROWS = [
['0', '10', 'Nothing left — went to failure'],
['1', '9', 'One more rep in the tank'],
['2', '8', 'Two more reps'],
['3', '7', 'Three more reps'],
['4+', '≤6', 'Easy — warm-up territory'],
]
// 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() {
useUI.getState().openSheet(close => <>
<h3>{t('Effort per set')}</h3>
<div className="muted small" style={{ lineHeight: 1.5 }}>
{t('How hard a set was, logged next to weight and reps. Two scales for the same judgement, counted from opposite ends.')}
</div>
<div className="efftbl">
<div className="r hd"><span className="n">{t('RIR')}</span><span className="n">{t('RPE')}</span><span className="f">{t('How it felt')}</span></div>
{EFFORT_ROWS.map(([rir, rpe, feel], i) => (
<div key={rir} className={'r' + (i === EFFORT_TYPICAL ? ' on' : '')}>
<span className="n">{rir}</span><span className="n">{rpe}</span><span className="f">{t(feel)}</span>
</div>
))}
</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 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 }} />
</>)
}
function NotificationsCard({ S, update, toast }) {
if (MOBILE) return <MobileReminderCard S={S} update={update} toast={toast} />
return <PushCard S={S} update={update} toast={toast} />
+18 -16
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 } 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'
@@ -75,24 +75,26 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
const col2 = cardio ? { f: 'speed', step: 0.5, dec: true, hd: t('Speed (km/h)') }
: timed ? { f: 'w', step: 2.5, dec: true, hd: t('Weight ({0})', S.unit) }
: { f: 'r', step: 1, dec: false, hd: t('Reps') }
// RIR (reps in reserve) only makes sense for weighted rep sets, not cardio/timed holds,
// and is opt-in (Settings) since it adds a third stepper to every row. `opt` because an
// unlogged RIR is not the same as RIR 0 — 0 says the set went to failure.
const col3 = mode === 'reps' && S.showRir ? { f: 'rir', step: 0.5, dec: true, opt: true, hd: t('RIR') } : null
// Stepping an optional field that was never filled in stays empty rather than clamping to 0:
// otherwise one stray − on a fresh row stamps "(RIR 0)" on the set for good. Going down from
// 0.5 still reaches a real 0.
// 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 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 && dir < 0) return
onField(i, col.f, Math.max(0, Math.round(((cur || 0) + dir * col.step) * 100) / 100))
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>
<span className="val"><NumberField decimal={col.dec} nullable={col.opt} value={s[col.f] ?? ''} onChange={v => onField(i, col.f, v)} /></span>
{/* 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, col.eff ? capEffort(col.eff, v) : v)} /></span>
<button aria-label="Increase" onClick={() => bump(s, i, col, 1)}><Icon name="plus" /></button>
</div>
)
@@ -114,13 +116,13 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
<span>{t(...plan.why)}</span>
</div>}
<div className="card" style={{ marginTop: 10, marginBottom: 0 }}>
{/* the header carries the same rir3 sizing as the rows, or the labels drift off their columns */}
<div className={'sethead' + (col3 ? ' rir3' : '')}><span className="n-sp" /><span className="w-sp">{col1.hd}</span><span className="r-sp">{col2.hd}</span>{col3 && <span className="rir-sp">{col3.hd}</span>}{timed && <span className="ck-sp" />}<span className="ck-sp" /></div>
{entry.sets.map((s, i) => <div key={i} className={'setrow' + (s.done ? ' done' : '') + (col3 ? ' rir3' : '')}>
{/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */}
<div className={'sethead' + (col3 ? ' eff3' : '')}><span className="n-sp" /><span className="w-sp">{col1.hd}</span><span className="r-sp">{col2.hd}</span>{col3 && <span className="eff-sp">{col3.hd}</span>}{timed && <span className="ck-sp" />}<span className="ck-sp" /></div>
{entry.sets.map((s, i) => <div key={i} className={'setrow' + (s.done ? ' done' : '') + (col3 ? ' eff3' : '')}>
<div className="n">{i + 1}</div>
{cell(s, i, col1, 'w')}
{cell(s, i, col2, 'r')}
{col3 && cell(s, i, col3, 'rir')}
{col3 && cell(s, i, col3, 'eff')}
{/* A timed set is started, not typed: the timer counts the hold down and checks the
set off itself. The checkbox stays for anyone who timed it on their own watch. */}
{timed && <button className="setgo" aria-label={t('Start set')} disabled={s.done || !!working}