diff --git a/CHANGELOG.md b/CHANGELOG.md index 91c3210..e18a297 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,10 +48,11 @@ progress lived in the load. It doesn't, for the exercises most people actually s and reaching it adds a set and starts the reps over instead of climbing forever; at six sets it says what it should have said all along, which is that it is time for weight or a harder variation. No ceiling set keeps the old behaviour exactly. (#33) -- ↔️ **Reps per side.** For lunges, single-arm rows and every other unilateral movement: log 8, - read "8/side", and the total is spelled out where there is room for it. Volume counts both - sides, so switching a routine to single-arm work no longer halves the session on the chart. - (#31) +- ↔️ **Reps per side.** For lunges, single-arm rows and every other unilateral movement. You + log what you did — 16, the total — and the app shows the split, "8 per side", so the set in + front of you is unambiguous without the rep count meaning one thing here and another there. + The target steps in twos, 16 → 18 → 20, because half of an odd total is a rep one side never + gets. (#31) - Both settings travel with a shared plan, and are written to a plan file only when they disagree with the catalogue — every existing plan, workout and backup is read unchanged and none of it needs migrating. diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js index 48361f4..c63b942 100644 --- a/frontend/src/lib/history.js +++ b/frontend/src/lib/history.js @@ -24,18 +24,21 @@ export const isTimed = cfg => modeOf(cfg) === 'time' // asked for only once you say there is some. Seeded from the equipment field. // Spelled out rather than `bw`, which a workout already uses for the weigh-in // it was logged at — two different things one letter apart is a bug waiting. -// side — the logged reps are what one side did: 8 logged is 8 per side, 16 in total. +// side — the exercise is unilateral. You still log what you did: 16, the total across +// both sides. The split is derived for planning ("8 per side"), never entered +// — a number that sometimes means one side and sometimes both is the thing +// that made this ambiguous in the first place, and one rep count that always +// means the same thing beats two that need a legend. // Both are absent on every plan, workout and backup written before they existed, and absent // reads as false, so nothing needs migrating. export const isBw = cfg => (cfg && cfg.bodyweight != null ? !!cfg.bodyweight : isBodyweightEq(cfg && cfg.id)) export const isPerSide = cfg => !!(cfg && cfg.side) -// Reps as they are counted rather than as they are logged. Only this function knows that a -// per-side set is worth double, so stats and volume cannot disagree with the set row. -export const totalReps = (cfg, reps) => (isPerSide(cfg) ? 2 : 1) * (reps || 0) -// Reps as they are written on a row: "8" bilateral, "8/side" unilateral. The total is left -// off here — a set row is already narrow, and "8/side · 16 total" belongs in the one place -// that has the width for it (the exercise line), not repeated down every row. -export const repLabel = (cfg, reps) => (isPerSide(cfg) ? t('{0}/side', reps) : String(reps)) +// What one side did, for display only. Half of an odd total is shown as it falls (8.5) rather +// than rounded away: it means the sides were not even, which is worth seeing. +export const sideReps = reps => (reps || 0) / 2 +// Unilateral work moves in pairs, so its rep target steps by two — 16, 18, 20 — and a total +// that stayed odd would put a rep on one side and not the other. +export const repStep = cfg => (isPerSide(cfg) ? 2 : 1) // mm:ss for a work duration — seconds alone read badly past a minute ("90 s" vs "1:30"). export function fmtSec(sec) { @@ -95,7 +98,9 @@ export function setLabel(id, s, cfg) { if (mode === 'time') return fmtSec(s.sec) + (s.w > 0 ? ` · ${fmtNum(s.w)}` : '') // Bodyweight reads as what you did — "12", or "+10 × 12" once there is a belt involved — // rather than "0×12", which says a set was performed with no weight and means nothing. - const reps = repLabel(c, s.r || 0) + // A per-side set needs no mark here: the number logged is the total, the same as every + // other set in the app. + const reps = s.r || 0 if (isBw({ ...c, id: c.id ?? id })) { const load = s.w > 0 ? `+${fmtNum(s.w)} × ` : '' return `${load}${reps}` + effortTail(s) @@ -121,9 +126,9 @@ export function exLine(cfg, unit) { const load = cfg.weight ? ' · ' + (isBw(cfg) ? '+' : '') + fmtNum(cfg.weight) + ' ' + unit : '' if (mode === 'cardio') return `${n} × ${cfg.min || 20} min @ ${fmtNum(cfg.speed || 8)} km/h` if (mode === 'time') return `${n} × ${fmtSec(cfg.sec || 45)}${load}` - // This is the line with room for the arithmetic, so per side spells it out in full. - const total = isPerSide(cfg) ? ' · ' + t('{0} in total', totalReps(cfg, cfg.reps) * n) : '' - return `${n} × ${repLabel(cfg, cfg.reps)}${load}${total}` + // This is the line with room for it, so the split is spelled out: "3 × 16 · 8/side". + const split = isPerSide(cfg) ? ' · ' + t('{0}/side', fmtNum(sideReps(cfg.reps))) : '' + return `${n} × ${cfg.reps}${load}${split}` } // Drop superset ids that no longer have an adjacent partner (after unlink/reorder/remove). @@ -200,9 +205,9 @@ export function buildSets(S, cfg) { } export function workoutVolume(w) { let v = 0 - // A per-side set moved its load twice, so it counts twice — otherwise a routine that - // switched to single-arm rows would show as half the work for the same session. - w.entries.forEach(e => e.sets.forEach(s => { if (s.done) v += (s.w || 0) * totalReps(e.target, s.r) })) + // No special case for unilateral work: a per-side set logs its total, so both sides are + // already in the rep count that arrives here. + w.entries.forEach(e => e.sets.forEach(s => { if (s.done) v += (s.w || 0) * (s.r || 0) })) return v } export function setsDone(w) { diff --git a/frontend/src/lib/history.test.js b/frontend/src/lib/history.test.js index 40ce472..fd11334 100644 --- a/frontend/src/lib/history.test.js +++ b/frontend/src/lib/history.test.js @@ -1,5 +1,5 @@ import { describe, it, expect } from 'vitest' -import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume, effortOf, stepEffort, capEffort, isBw, isPerSide, totalReps } from './history.js' +import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume, effortOf, stepEffort, capEffort, isBw, isPerSide, sideReps, repStep } from './history.js' import { EXDB } from './exercises.js' // Real ids out of the shipped catalogue, so the body-part fallback is exercised for real. @@ -278,11 +278,21 @@ describe('isBw', () => { }) }) -describe('totalReps', () => { - it('doubles a per-side set and leaves a bilateral one alone', () => { - expect(totalReps({ side: true }, 8)).toBe(16) - expect(totalReps({}, 8)).toBe(8) - expect(totalReps({ side: true }, 0)).toBe(0) +describe('sideReps', () => { + it('halves the logged total, because the total is what was logged', () => { + expect(sideReps(16)).toBe(8) + expect(sideReps(0)).toBe(0) + }) + it('shows an odd total as it falls rather than rounding the imbalance away', () => { + expect(sideReps(17)).toBe(8.5) + }) +}) + +describe('repStep', () => { + it('steps unilateral work in twos so the total stays splittable', () => { + expect(repStep({ side: true })).toBe(2) + expect(repStep({})).toBe(1) + expect(repStep(null)).toBe(1) }) }) @@ -293,9 +303,9 @@ describe('setLabel — bodyweight', () => { it('spells out a belt as an addition', () => { expect(setLabel(BW, { w: 10, r: 8 }, { id: BW })).toBe('+10 × 8') }) - it('marks a per-side set on both paths', () => { - expect(setLabel(BW, { w: 0, r: 8 }, { id: BW, side: true })).toBe('8/side') - expect(setLabel(LIFT, { w: 20, r: 8 }, { id: LIFT, side: true })).toBe('20×8/side') + it('logs a per-side set as the plain total, like every other set in the app', () => { + expect(setLabel(BW, { w: 0, r: 16 }, { id: BW, side: true })).toBe('16') + expect(setLabel(LIFT, { w: 20, r: 16 }, { id: LIFT, side: true })).toBe('20×16') }) it('keeps the effort tail', () => { expect(setLabel(BW, { w: 0, r: 12, rir: 2 }, { id: BW })).toBe('12 (RIR 2)') @@ -303,8 +313,8 @@ describe('setLabel — bodyweight', () => { }) describe('exLine', () => { - it('shows the per-side arithmetic where there is room for it', () => { - expect(exLine({ id: LIFT, sets: 3, reps: 8, side: true }, 'kg')).toBe('3 × 8/side · 48 in total') + it('shows the split where there is room for it, next to the total you log', () => { + expect(exLine({ id: LIFT, sets: 3, reps: 16, side: true }, 'kg')).toBe('3 × 16 · 8/side') }) it('marks added weight as added', () => { expect(exLine({ id: BW, sets: 3, reps: 8, weight: 10 }, 'kg')).toBe('3 × 8 · +10 kg') @@ -370,8 +380,8 @@ describe('workoutVolume', () => { expect(workoutVolume(w)).toBe(600) }) - it('counts a per-side set twice — the load moved twice (issue #31)', () => { - const w = { entries: [{ id: LIFT, target: { side: true }, sets: [{ w: 20, r: 8, done: true }] }] } + it('needs no per-side case — the logged reps are already both sides (issue #31)', () => { + const w = { entries: [{ id: LIFT, target: { side: true }, sets: [{ w: 20, r: 16, done: true }] }] } expect(workoutVolume(w)).toBe(320) }) diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js index bb69e91..a09718b 100644 --- a/frontend/src/lib/plan-share.js +++ b/frontend/src/lib/plan-share.js @@ -9,7 +9,7 @@ // a page break — each exercise, and each routine that fits, stays in one place. import { EXIDX, isBodyweightEq } from './exercises.js' -import { modeOf, fmtSec, isBw, repLabel } from './history.js' +import { modeOf, fmtSec, isBw, isPerSide, sideReps } from './history.js' import { uid, todayISO, DAYN, fmtNum, exCount } from './format.js' import { t } from './i18n.js' @@ -149,8 +149,10 @@ function scheme(e, unit) { const body = `${e.min || 20} min @ ${fmtNum(e.speed || 8)} km/h` return sets > 1 ? `${sets} × ${body}` : body } - let s = mode === 'time' ? `${sets} × ${fmtSec(e.sec || 45)}` : `${sets} × ${repLabel(e, e.reps ?? 10)}` + let s = mode === 'time' ? `${sets} × ${fmtSec(e.sec || 45)}` : `${sets} × ${e.reps ?? 10}` if (e.weight) s += ` · ${isBw(e) ? '+' : ''}${fmtNum(e.weight)} ${unit}` + // A printed plan is read at the rack, so the split earns its four characters. + if (mode !== 'time' && isPerSide(e)) s += ` · ${t('{0}/side', fmtNum(sideReps(e.reps ?? 10)))}` return s } diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.js index bb4dab3..17825a8 100644 --- a/frontend/src/lib/progression.js +++ b/frontend/src/lib/progression.js @@ -16,7 +16,7 @@ // · fewer sets than prescribed → miss // So a session that fell apart can never advance the load as though it had succeeded. -import { modeOf } from './history.js' +import { modeOf, repStep } from './history.js' import { EXIDX } from './exercises.js' export const POLICIES = ['off', 'linear', 'greyskull', 'double', 'time'] @@ -202,7 +202,9 @@ export function nextPrescription(S, cfg, routine) { // variation is — and that is a decision for a person, not a policy. return { policy, kind: 'hold', weight: 0, reps: goal, why: ['{0} sets of {1} — time to add weight or move to a harder variation.', sets - 1, goal] } } - return { policy, kind: 'up', weight: 0, reps: goal + 1, why: ['Bodyweight — every rep last time, so go for {0} this time.', goal + 1] } + // Unilateral work steps by two, so the total stays even and both sides get the rep. + const next = goal + repStep(cfg) + return { policy, kind: 'up', weight: 0, reps: next, why: ['Bodyweight — every rep last time, so go for {0} this time.', next] } } if (policy === 'double') { const top = cfg.reps || last.goal || 10 @@ -212,7 +214,7 @@ export function nextPrescription(S, cfg, routine) { const dw = deloadTo(w, inc) return { policy, kind: 'deload', weight: dw, reps: bottom, why: ['Stalled {0} sessions — deload to {1} {2}.', stalls, dw, unit] } } - const aim = Math.min(top, Math.max(bottom, last.low + 1)) + const aim = Math.min(top, Math.max(bottom, last.low + repStep(cfg))) return { policy, kind: 'hold', weight: w, reps: aim, why: ['Same weight — aim for {0} reps this time.', aim] } } diff --git a/frontend/src/lib/progression.test.js b/frontend/src/lib/progression.test.js index 9901edf..e3689aa 100644 --- a/frontend/src/lib/progression.test.js +++ b/frontend/src/lib/progression.test.js @@ -222,6 +222,13 @@ describe('bodyweight exercises', () => { expect(p.sets).toBeUndefined() }) + it('steps a unilateral total by two, so it lands on 16, 18, 20 (issue #31)', () => { + const at16 = hist(LIFT, [[0, 16, 16, 16]], { sets: 3, reps: 16 }) + expect(nextPrescription(at16, { ...cfg, reps: 16, side: true }).reps).toBe(18) + // and by one when it is not + expect(nextPrescription(at16, { ...cfg, reps: 16 }).reps).toBe(17) + }) + it('keeps climbing reps forever when no ceiling was set — the old behaviour', () => { const at30 = hist(LIFT, [[0, 30, 30, 30]], { sets: 3, reps: 30 }) const p = nextPrescription(at30, cfg) diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js index 31a197d..7d5fade 100644 --- a/frontend/src/locales/de.js +++ b/frontend/src/locales/de.js @@ -563,15 +563,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'Für Dips oder Klimmzüge mit Gürtel. Die Progression folgt dann dem Gewicht.', 'Reps per side': 'Wiederholungen pro Seite', 'For lunges, single-arm rows and the like.': 'Für Ausfallschritte, einarmiges Rudern und Ähnliches.', - '{0} logged is {1} in total.': '{0} eingetragen sind insgesamt {1}.', 'Top of the range': 'Oberes Ende', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Die Wiederholungen steigen um eine, sobald jeder Satz sauber war. Setz ein oberes Ende, damit irgendwann ein Satz dazukommt statt immer mehr Wiederholungen.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Die Wiederholungen steigen bis {0}, dann kommt ein Satz dazu und die Wiederholungen starten neu. Bei {1} Sätzen wird stattdessen nach Zusatzgewicht gefragt.', 'Added ({0})': 'Zusatz ({0})', - 'Reps/side': 'Wdh./Seite', - 'Per side · {0} in total': 'Pro Seite · {0} insgesamt', '{0}/side': '{0}/Seite', - '{0} in total': '{0} insgesamt', '{0} reps in every set — add a set and go back to {1}.': '{0} Wiederholungen in jedem Satz — ein Satz kommt dazu, zurück auf {1}.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{0} Sätze mit {1} — Zeit für Zusatzgewicht oder eine schwerere Variante.', + '{0} per side': '{0} pro Seite', + 'You still log the total: {0} is {1} per side.': 'Du trägst weiterhin die Gesamtzahl ein: {0} sind {1} pro Seite.', } diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js index 2bd31b5..e0ef7c7 100644 --- a/frontend/src/locales/es.js +++ b/frontend/src/locales/es.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'Para fondos o dominadas con cinturón. La progresión sigue entonces el peso.', 'Reps per side': 'Reps por lado', 'For lunges, single-arm rows and the like.': 'Para zancadas, remo a una mano y similares.', - '{0} logged is {1} in total.': '{0} registradas son {1} en total.', 'Top of the range': 'Tope del rango', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Las reps suben de una en una cuando todas las series salen limpias. Fija un tope para añadir series en vez de reps para siempre.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Las reps suben hasta {0}, luego se añade una serie y las reps vuelven a empezar. Con {1} series te pedirá añadir peso.', 'Added ({0})': 'Extra ({0})', - 'Reps/side': 'Reps/lado', - 'Per side · {0} in total': 'Por lado · {0} en total', '{0}/side': '{0}/lado', - '{0} in total': '{0} en total', '{0} reps in every set — add a set and go back to {1}.': '{0} reps en todas las series: añade una serie y vuelve a {1}.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{0} series de {1}: toca añadir peso o pasar a una variante más difícil.', + '{0} per side': '{0} por lado', + 'You still log the total: {0} is {1} per side.': 'Sigues registrando el total: {0} son {1} por lado.', } diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js index 35b24f6..16fa1f0 100644 --- a/frontend/src/locales/fr.js +++ b/frontend/src/locales/fr.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'Pour les dips ou les tractions avec une ceinture. La progression suit alors le poids.', 'Reps per side': 'Reps par côté', 'For lunges, single-arm rows and the like.': 'Pour les fentes, les rowings à un bras et compagnie.', - '{0} logged is {1} in total.': '{0} notées, soit {1} au total.', 'Top of the range': 'Haut de la fourchette', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Les répétitions montent d’une dès que toutes les séries sont propres. Fixe un plafond pour ajouter une série au lieu de monter les répétitions sans fin.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Les répétitions montent jusqu’à {0}, puis une série est ajoutée et les répétitions repartent du bas. À {1} séries, c’est du poids qu’il te demande d’ajouter.', 'Added ({0})': 'Ajouté ({0})', - 'Reps/side': 'Reps/côté', - 'Per side · {0} in total': 'Par côté · {0} au total', '{0}/side': '{0}/côté', - '{0} in total': '{0} au total', '{0} reps in every set — add a set and go back to {1}.': '{0} répétitions sur toutes les séries — une série en plus, retour à {1}.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{0} séries de {1} — il est temps d’ajouter du poids ou de passer à une variante plus dure.', + '{0} per side': '{0} par côté', + 'You still log the total: {0} is {1} per side.': 'Tu notes toujours le total : {0}, c’est {1} par côté.', } diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js index f606dde..38de4bc 100644 --- a/frontend/src/locales/hi.js +++ b/frontend/src/locales/hi.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'बेल्ट के साथ डिप्स या पुल-अप्स के लिए। फिर प्रोग्रेशन वज़न के हिसाब से चलता है।', 'Reps per side': 'प्रति तरफ़ रेप्स', 'For lunges, single-arm rows and the like.': 'लंजेस, सिंगल-आर्म रो और ऐसे व्यायामों के लिए।', - '{0} logged is {1} in total.': 'दर्ज {0} यानी कुल {1}।', 'Top of the range': 'रेंज का ऊपरी सिरा', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'हर सेट साफ़ रहने पर रेप्स एक-एक बढ़ते हैं। ऊपरी सीमा तय करें ताकि रेप्स हमेशा बढ़ने के बजाय एक सेट जुड़ जाए।', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'रेप्स {0} तक बढ़ते हैं, फिर एक सेट जुड़ता है और रेप्स दोबारा शुरू होते हैं। {1} सेट पर यह वज़न बढ़ाने को कहता है।', 'Added ({0})': 'अतिरिक्त ({0})', - 'Reps/side': 'रेप्स/तरफ़', - 'Per side · {0} in total': 'प्रति तरफ़ · कुल {0}', '{0}/side': '{0}/तरफ़', - '{0} in total': 'कुल {0}', '{0} reps in every set — add a set and go back to {1}.': 'हर सेट में {0} रेप्स — एक सेट जोड़ें और वापस {1} पर।', '{0} sets of {1} — time to add weight or move to a harder variation.': '{1} रेप्स के {0} सेट — अब वज़न बढ़ाने या किसी कठिन वैरिएशन पर जाने का समय।', + '{0} per side': 'प्रति तरफ़ {0}', + 'You still log the total: {0} is {1} per side.': 'आप कुल ही दर्ज करते हैं: {0} यानी प्रति तरफ़ {1}।', } diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js index 3e7e469..f3ebe71 100644 --- a/frontend/src/locales/it.js +++ b/frontend/src/locales/it.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'Per dip o trazioni con la cintura. La progressione segue poi il peso.', 'Reps per side': 'Ripetizioni per lato', 'For lunges, single-arm rows and the like.': 'Per affondi, rematori a un braccio e simili.', - '{0} logged is {1} in total.': '{0} registrate sono {1} in totale.', 'Top of the range': 'Massimo dell\'intervallo', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Le ripetizioni salgono di una ogni volta che tutte le serie sono pulite. Imposta un massimo per aggiungere serie invece di ripetizioni all\'infinito.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Le ripetizioni salgono fino a {0}, poi viene aggiunta una serie e le ripetizioni ripartono da capo. A {1} serie ti chiede invece di aggiungere peso.', 'Added ({0})': 'Aggiunto ({0})', - 'Reps/side': 'Rip./lato', - 'Per side · {0} in total': 'Per lato · {0} in totale', '{0}/side': '{0}/lato', - '{0} in total': '{0} in totale', '{0} reps in every set — add a set and go back to {1}.': '{0} ripetizioni in ogni serie — aggiungi una serie e torna a {1}.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{0} serie da {1} — è ora di aggiungere peso o passare a una variante più difficile.', + '{0} per side': '{0} per lato', + 'You still log the total: {0} is {1} per side.': 'Registri sempre il totale: {0} sono {1} per lato.', } diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js index cee5d93..d4e9cb7 100644 --- a/frontend/src/locales/ko.js +++ b/frontend/src/locales/ko.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': '벨트를 차고 하는 딥스나 풀업용. 그러면 점진적 증가가 무게를 따라갑니다.', 'Reps per side': '한쪽당 횟수', 'For lunges, single-arm rows and the like.': '런지, 한팔 로우 같은 운동용.', - '{0} logged is {1} in total.': '{0}회 기록하면 총 {1}회입니다.', 'Top of the range': '범위 상한', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': '모든 세트가 깔끔하면 횟수가 하나씩 올라갑니다. 상한을 정하면 횟수를 계속 늘리는 대신 세트를 추가합니다.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': '횟수가 {0}회까지 오르면 세트가 하나 추가되고 횟수는 처음부터 다시 시작합니다. {1}세트가 되면 대신 무게를 올리라고 안내합니다.', 'Added ({0})': '추가 ({0})', - 'Reps/side': '한쪽 횟수', - 'Per side · {0} in total': '한쪽 기준 · 총 {0}회', '{0}/side': '한쪽 {0}회', - '{0} in total': '총 {0}회', '{0} reps in every set — add a set and go back to {1}.': '모든 세트 {0}회 달성 — 세트를 추가하고 {1}회로 돌아갑니다.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{1}회 {0}세트 — 이제 무게를 올리거나 더 어려운 동작으로 넘어가세요.', + '{0} per side': '한쪽당 {0}회', + 'You still log the total: {0} is {1} per side.': '기록은 그대로 합계로 합니다: {0}회는 한쪽당 {1}회입니다.', } diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js index c091ed0..c6c5552 100644 --- a/frontend/src/locales/pl.js +++ b/frontend/src/locales/pl.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'Do dipów albo podciągania z pasem. Progresja idzie wtedy za ciężarem.', 'Reps per side': 'Powtórzenia na stronę', 'For lunges, single-arm rows and the like.': 'Do wykroków, wiosłowania jednorącz i podobnych.', - '{0} logged is {1} in total.': 'Zapisujesz {0} — łącznie {1}.', 'Top of the range': 'Górna granica zakresu', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Powtórzenia rosną o jedno, gdy każda seria jest czysta. Ustaw górną granicę, aby zamiast powtórzeń w nieskończoność dochodziły serie.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Powtórzenia rosną do {0}, potem dochodzi seria, a powtórzenia zaczynają od nowa. Przy {1} seriach aplikacja poprosi zamiast tego o dodanie ciężaru.', 'Added ({0})': 'Dodane ({0})', - 'Reps/side': 'Powt./str.', - 'Per side · {0} in total': 'Na stronę · łącznie {0}', '{0}/side': '{0}/str.', - '{0} in total': 'łącznie {0}', '{0} reps in every set — add a set and go back to {1}.': 'Wszystkie serie po {0} powt. — dodaj serię i wróć do {1}.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{0} × {1} powt. — czas dodać ciężar albo przejść na trudniejszy wariant.', + '{0} per side': '{0} na stronę', + 'You still log the total: {0} is {1} per side.': 'Nadal zapisujesz łączną liczbę: {0} to {1} na stronę.', } diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js index 3534e21..beedcb8 100644 --- a/frontend/src/locales/pt.js +++ b/frontend/src/locales/pt.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'Para dips ou pull-ups com cinto. A progressão passa então a seguir o peso.', 'Reps per side': 'Reps por lado', 'For lunges, single-arm rows and the like.': 'Para afundos, remadas a um braço e afins.', - '{0} logged is {1} in total.': '{0} registadas dão {1} no total.', 'Top of the range': 'Topo do intervalo', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'As repetições sobem uma sempre que todas as séries saem limpas. Define um limite para acrescentar séries em vez de repetições para sempre.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'As repetições sobem até {0}, depois acrescenta-se uma série e as repetições recomeçam. Com {1} séries passa a pedir-te peso extra.', 'Added ({0})': 'Extra ({0})', - 'Reps/side': 'Reps/lado', - 'Per side · {0} in total': 'Por lado · {0} no total', '{0}/side': '{0}/lado', - '{0} in total': '{0} no total', '{0} reps in every set — add a set and go back to {1}.': '{0} repetições em todas as séries — acrescenta uma série e volta a {1}.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{0} séries de {1} — hora de acrescentar peso ou passar a uma variação mais difícil.', + '{0} per side': '{0} por lado', + 'You still log the total: {0} is {1} per side.': 'Continuas a registar o total: {0} são {1} por lado.', } diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js index 7d05fed..cb45f3e 100644 --- a/frontend/src/locales/ru.js +++ b/frontend/src/locales/ru.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'Для отжиманий на брусьях или подтягиваний с поясом. Тогда прогрессия идёт по весу.', 'Reps per side': 'Повторения на сторону', 'For lunges, single-arm rows and the like.': 'Для выпадов, тяг одной рукой и тому подобного.', - '{0} logged is {1} in total.': 'Записано {0} — всего {1}.', 'Top of the range': 'Верх диапазона', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Повторения растут на одно, когда все подходы чистые. Задай потолок, чтобы вместо бесконечного роста повторений добавлялся подход.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Повторения растут до {0}, затем добавляется подход и повторения начинаются заново. Дойдя до {1} подходов, приложение предложит вместо этого добавить вес.', 'Added ({0})': 'Доп. ({0})', - 'Reps/side': 'Повт./стор.', - 'Per side · {0} in total': 'На сторону · всего {0}', '{0}/side': '{0}/стор.', - '{0} in total': 'всего {0}', '{0} reps in every set — add a set and go back to {1}.': 'Во всех подходах {0} повт. — добавь подход и вернись к {1}.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{0} × {1} — пора добавить вес или перейти к более сложному варианту.', + '{0} per side': '{0} на сторону', + 'You still log the total: {0} is {1} per side.': 'Ты по-прежнему записываешь общее число: {0} — это {1} на сторону.', } diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js index 1dbd6bf..d4a8051 100644 --- a/frontend/src/locales/tr.js +++ b/frontend/src/locales/tr.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': 'Kemerle yapılan dips veya barfiks için. İlerleme o zaman ağırlığı izler.', 'Reps per side': 'Taraf başına tekrar', 'For lunges, single-arm rows and the like.': 'Lunge, tek kol çekiş ve benzeri hareketler için.', - '{0} logged is {1} in total.': 'Kaydedilen {0}, toplamda {1} eder.', 'Top of the range': 'Aralığın üst sınırı', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': 'Her set temiz çıktığında tekrarlar birer artar. Sonsuza kadar tekrar eklemek yerine set eklemek için bir üst sınır belirle.', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': 'Tekrarlar {0} değerine çıkar, sonra bir set eklenir ve tekrarlar baştan başlar. {1} sette ise bunun yerine ağırlık eklemen istenir.', 'Added ({0})': 'Ek ({0})', - 'Reps/side': 'Tekrar/taraf', - 'Per side · {0} in total': 'Taraf başına · toplam {0}', '{0}/side': '{0}/taraf', - '{0} in total': 'toplam {0}', '{0} reps in every set — add a set and go back to {1}.': 'Her sette {0} tekrar — bir set ekle ve {1} tekrara dön.', '{0} sets of {1} — time to add weight or move to a harder variation.': '{1} tekrarlık {0} set — ağırlık ekleme ya da daha zor bir varyasyona geçme zamanı.', + '{0} per side': 'Taraf başına {0}', + 'You still log the total: {0} is {1} per side.': 'Toplamı kaydetmeye devam ediyorsun: {0}, taraf başına {1} demek.', } diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js index fcaddf3..0082dc1 100644 --- a/frontend/src/locales/zh.js +++ b/frontend/src/locales/zh.js @@ -546,15 +546,13 @@ export default { 'For dips or pull-ups with a belt. Progression then follows the weight.': '用于系负重腰带做双杠臂屈伸或引体向上。此时进阶方式跟随重量。', 'Reps per side': '每侧次数', 'For lunges, single-arm rows and the like.': '用于弓步蹲、单臂划船之类的动作。', - '{0} logged is {1} in total.': '记录 {0} 次,合计 {1} 次。', 'Top of the range': '次数上限', 'Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.': '每组都做干净,次数就加一。设置上限后,达到上限会加一组,而不是一直加次数。', 'Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.': '次数升到 {0} 后加一组,次数重新开始。到 {1} 组时会改为提示你加重量。', 'Added ({0})': '负重({0})', - 'Reps/side': '每侧次数', - 'Per side · {0} in total': '每侧 · 合计 {0}', '{0}/side': '{0}/侧', - '{0} in total': '合计 {0}', '{0} reps in every set — add a set and go back to {1}.': '每组都做到 {0} 次——加一组,次数回到 {1}。', '{0} sets of {1} — time to add weight or move to a harder variation.': '{0} 组 × {1} 次——该加重量或换更难的变式了。', + '{0} per side': '每侧 {0} 次', + 'You still log the total: {0} is {1} per side.': '你记录的仍然是总数:{0} 表示每侧 {1} 次。', } diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx index 0efe6a3..8d0ce7a 100644 --- a/frontend/src/sheets.jsx +++ b/frontend/src/sheets.jsx @@ -3,7 +3,7 @@ import { useStore } from './store/useStore.js' import { useUI } from './store/useUI.js' import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, 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, effortOf, isBw, isPerSide } from './lib/history.js' +import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, isBw, isPerSide, sideReps } 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' @@ -510,7 +510,10 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) { 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 { - const reps = Math.max(1, Math.round(c.reps) || 10) + // A unilateral target is stored even: the split has to divide, and a typed 15 would + // 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 } 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. @@ -541,7 +544,7 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) { setC(x => ({ ...x, weight: v }))} /> : <> setC(x => ({ ...x, sets: v }))} /> - setC(x => ({ ...x, reps: v }))} /> + setC(x => ({ ...x, reps: v }))} /> {/* On bodyweight work the weight stepper is the click #32 is about, so it is not here until there is a belt to describe — see the added-weight row below. */} {!bw && setC(x => ({ ...x, weight: v }))} />} @@ -561,8 +564,10 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) { setC(x => ({ ...x, weight: v }))} /> } {mode === 'reps' && - setC(x => ({ ...x, side: v || undefined }))} /> + subtitle={perSide ? t('You still log the total: {0} is {1} per side.', c.reps || 0, fmtNum(sideReps(c.reps))) : t('For lunges, single-arm rows and the like.')}> + {/* Turning it on rounds the target up to an even number, since half of an odd + total is a rep one side does not get. */} + setC(x => ({ ...x, side: v || undefined, reps: v ? Math.ceil((x.reps || 0) / 2) * 2 : x.reps }))} /> } } {/* The rep ceiling only means something when there is no load to add instead. */} diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx index ace7a7d..c7446bb 100644 --- a/frontend/src/views/Workout.jsx +++ b/frontend/src/views/Workout.jsx @@ -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
{cardio && {t('Cardio')}} - {/* The set rows say "8"; this is where the arithmetic fits (issue #31). */} - {isPerSide(cfg) && {t('Per side · {0} in total', totalReps(cfg, entry.sets[0]?.r) * entry.sets.length)}} + {/* 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) && {t('{0} per side', fmtNum(sideReps(entry.sets.find(s => !s.done)?.r ?? entry.sets[0]?.r)))}} {(ex.tg || ex.bp) && {t(ex.tg || ex.bp)}} {ex.eq && {t(ex.eq)}} {best > 0 && {t('Best:')} {fmtNum(best)} {S.unit}}