From c33ff15d9d4f8d1a3b46845064c69651e9a0d078 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Sat, 1 Aug 2026 16:37:52 +0200 Subject: [PATCH] Bodyweight work, logged the way it is done MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A push-up has no weight to type and the app asked for one anyway, on a quarter of the catalogue. Issues #31, #32 and #33 are the same gap seen from three sides: the app assumed progress lived in the load. Two flags on the exercise config rather than two new modes, because "bodyweight" and "per side" are equally true of a rep set and a timed hold: bodyweight — seeded from the equipment the dataset already records. The weight column is gone, the set row is one stepper, and the working-weight prompt stops asking about a weight that was never there. A belt weight reads as an addition and hands progression back to the normal policies, because now there is something to add. side — 8 logged is 8 per side. The total is spelled out where there is width for it, and volume counts both sides so a routine that moved to single-arm work no longer halves itself on the chart. Bodyweight progression grows reps, and now sets: a rep ceiling sends the reps back to the bottom and adds a set instead of climbing forever, stopping at six with the advice it should have given all along. No ceiling keeps the old behaviour exactly. Both flags are written to a plan only when they disagree with the catalogue, and absent reads as false, so every existing plan, workout and backup is read unchanged. --- CHANGELOG.md | 27 ++++++++++++ frontend/src/lib/exercises.js | 7 +++ frontend/src/lib/history.js | 52 ++++++++++++++++++---- frontend/src/lib/history.test.js | 65 +++++++++++++++++++++++++++- frontend/src/lib/plan-share.js | 13 ++++-- frontend/src/lib/progression.js | 48 +++++++++++++++----- frontend/src/lib/progression.test.js | 54 ++++++++++++++++++++++- frontend/src/locales/de.js | 19 ++++++++ frontend/src/locales/es.js | 20 +++++++++ frontend/src/locales/fr.js | 20 +++++++++ frontend/src/locales/hi.js | 20 +++++++++ frontend/src/locales/it.js | 20 +++++++++ frontend/src/locales/ko.js | 20 +++++++++ frontend/src/locales/pl.js | 20 +++++++++ frontend/src/locales/pt.js | 20 +++++++++ frontend/src/locales/ru.js | 20 +++++++++ frontend/src/locales/tr.js | 20 +++++++++ frontend/src/locales/zh.js | 20 +++++++++ frontend/src/sheets.jsx | 53 +++++++++++++++++++---- frontend/src/views/Workout.jsx | 30 +++++++++---- 20 files changed, 524 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 639b839..91c3210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,33 @@ label and nowhere else. Stats now answers the question the number was recorded f sit higher. - Translated into all 12 UI languages. +### Bodyweight training, logged the way it is done + +A push-up has no weight to type, and the app asked for one anyway — every set, on a quarter of +the catalogue. Three reports (#31, #32, #33) turned out to be the same gap: the app assumed +progress lived in the load. It doesn't, for the exercises most people actually start with. + +- 💪 **Exercises know they are bodyweight.** Seeded from the equipment the dataset already + records, so push-ups, pull-ups, dips and 300-odd others arrive marked. The weight column is + not shown, the set row is one stepper instead of two, and the "confirm your working weight" + prompt at the end of an exercise stops asking about a weight that was never there. (#32) +- **Added weight when there is any.** A dip belt or a weighted vest is entered once in the + exercise settings and reads as an addition — "+10 × 8", not "10×8" — everywhere it is shown + back. With load on the belt the normal progression rules take over again, because now there + is something to add. +- 📈 **Reps and sets are the progression.** Clean session, one more rep. Set a top of the range + 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) +- 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. +- Translated into all 12 UI languages. + ## v1.2.3 — 2026-07-31 How hard a set was, in whichever of the two scales you already think in — and the ratings your diff --git a/frontend/src/lib/exercises.js b/frontend/src/lib/exercises.js index 20d82d2..c26e1f7 100644 --- a/frontend/src/lib/exercises.js +++ b/frontend/src/lib/exercises.js @@ -37,6 +37,13 @@ export const gifSrc = ex => GIF_BASE + ex.gif // Cardio exercises log time + speed instead of weight × reps. export const isCardio = idOrEx => (typeof idOrEx === 'string' ? EXIDX[idOrEx] : idOrEx)?.bp === 'cardio' +// Exercises the dataset already knows carry no external load (issue #32) — a quarter of the +// catalogue. This seeds the `bw` flag on a fresh config so a push-up never asks for a weight +// nobody was going to enter. It is only the default: the flag lives on the config, so a dip +// done with a belt can turn it off and a custom exercise can turn it on. +export const isBodyweightEq = idOrEx => + (typeof idOrEx === 'string' ? EXIDX[idOrEx] : idOrEx)?.eq === 'body weight' + // An id that resolves to nothing — a plan file built against a different exercise dataset, // a custom exercise deleted on another device before the sync arrived — still has to // render. A placeholder keeps it visible (and removable) instead of taking the whole view diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js index fbe2df9..48361f4 100644 --- a/frontend/src/lib/history.js +++ b/frontend/src/lib/history.js @@ -1,6 +1,7 @@ // Pure helpers over the state object S (ported 1:1 from the vanilla app). import { todayISO, isoOf, weekKey, fmtNum } from './format.js' -import { isCardio } from './exercises.js' +import { isCardio, isBodyweightEq } from './exercises.js' +import { t } from './i18n.js' // How an exercise is logged (issue #16). This used to be derived from the body part alone, // which meant a plank or a farmer's carry could only be timed by filing it under cardio. @@ -17,6 +18,25 @@ export function modeOf(cfg) { } export const isTimed = cfg => modeOf(cfg) === 'time' +// Two flags that ride on top of a mode rather than making new ones (issues #31/#32), because +// "bodyweight" and "per side" are true of a rep set and of a timed hold alike: +// bodyweight — the exercise carries no load of its own, so `w` means *added* weight and is +// 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. +// 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)) + // mm:ss for a work duration — seconds alone read badly past a minute ("90 s" vs "1:30"). export function fmtSec(sec) { const n = Math.max(0, Math.round(Number(sec) || 0)) @@ -69,27 +89,41 @@ const effortTail = s => { // 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 }) + const c = cfg || { id } + const mode = modeOf(c) 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}` + effortTail(s) + // 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) + if (isBw({ ...c, id: c.id ?? id })) { + const load = s.w > 0 ? `+${fmtNum(s.w)} × ` : '' + return `${load}${reps}` + effortTail(s) + } + return `${fmtNum(s.w || 0)}×${reps}` + effortTail(s) } // Default config for a freshly added exercise. export function defaultConfig(id, mode) { const m = mode || modeOf({ id }) if (m === 'cardio') return { sets: 1, min: 20, speed: 8 } - if (m === 'time') return { sets: 3, sec: 45, weight: 0, mode: 'time' } - return { sets: 3, reps: 10, weight: 0, mode: 'reps' } + // Written only when it is true, so a barbell config is byte-for-byte what it was before + // the flag existed and a plan file gains nothing it does not need. + const bw = isBodyweightEq(id) ? { bodyweight: true } : {} + if (m === 'time') return { sets: 3, sec: 45, weight: 0, mode: 'time', ...bw } + return { sets: 3, reps: 10, weight: 0, mode: 'reps', ...bw } } // One-line summary of a planned exercise ("3 × 10 · 60 kg"), shared by the routine editor // and the plan export so a mode is described the same way everywhere. export function exLine(cfg, unit) { const mode = modeOf(cfg) const n = cfg.sets || 1 - const load = cfg.weight ? ' · ' + fmtNum(cfg.weight) + ' ' + unit : '' + // Added weight reads as added: "+10 kg" on a dip belt, "60 kg" on a barbell. + 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}` - return `${n} × ${cfg.reps}${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}` } // Drop superset ids that no longer have an adjacent partner (after unlink/reorder/remove). @@ -166,7 +200,9 @@ export function buildSets(S, cfg) { } export function workoutVolume(w) { let v = 0 - w.entries.forEach(e => e.sets.forEach(s => { if (s.done) v += (s.w || 0) * (s.r || 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) })) return v } export function setsDone(w) { diff --git a/frontend/src/lib/history.test.js b/frontend/src/lib/history.test.js index fac4207..40ce472 100644 --- a/frontend/src/lib/history.test.js +++ b/frontend/src/lib/history.test.js @@ -1,10 +1,13 @@ import { describe, it, expect } from 'vitest' -import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume, effortOf, stepEffort, capEffort } from './history.js' +import { modeOf, isTimed, fmtSec, setLabel, defaultConfig, buildSets, exLine, workoutVolume, effortOf, stepEffort, capEffort, isBw, isPerSide, totalReps } from './history.js' import { EXDB } from './exercises.js' // Real ids out of the shipped catalogue, so the body-part fallback is exercised for real. const CARDIO = EXDB.find(e => e.bp === 'cardio').id -const LIFT = EXDB.find(e => e.bp !== 'cardio').id +// A *loaded* lift: the catalogue's first non-cardio entry is a sit-up, which since issue #32 +// defaults to bodyweight and would quietly send every label test down the other path. +const LIFT = EXDB.find(e => e.bp !== 'cardio' && e.eq !== 'body weight').id +const BW = EXDB.find(e => e.eq === 'body weight').id describe('modeOf', () => { it('falls back to the body part when a plan has no mode — every existing plan keeps working', () => { @@ -255,9 +258,57 @@ describe('defaultConfig', () => { expect(defaultConfig(CARDIO)).toEqual({ sets: 1, min: 20, speed: 8 }) expect(defaultConfig(LIFT, 'time')).toEqual({ sets: 3, sec: 45, weight: 0, mode: 'time' }) }) + it('seeds the bodyweight flag from the catalogue, and only when it is true', () => { + expect(defaultConfig(BW)).toEqual({ sets: 3, reps: 10, weight: 0, mode: 'reps', bodyweight: true }) + expect(defaultConfig(BW, 'time')).toEqual({ sets: 3, sec: 45, weight: 0, mode: 'time', bodyweight: true }) + expect('bodyweight' in defaultConfig(LIFT)).toBe(false) + }) +}) + +/* ---------- bodyweight and per side (issues #31/#32/#33) ---------- */ + +describe('isBw', () => { + it('defaults from the catalogue so an existing plan needs no flag', () => { + expect(isBw({ id: BW })).toBe(true) + expect(isBw({ id: LIFT })).toBe(false) + }) + it('lets the config win in both directions — a belt on a dip, a flag on a machine', () => { + expect(isBw({ id: BW, bodyweight: false })).toBe(false) + expect(isBw({ id: LIFT, bodyweight: true })).toBe(true) + }) +}) + +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('setLabel — bodyweight', () => { + it('reads as reps alone, because "0×12" describes nothing', () => { + expect(setLabel(BW, { w: 0, r: 12 }, { id: BW })).toBe('12') + }) + 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('keeps the effort tail', () => { + expect(setLabel(BW, { w: 0, r: 12, rir: 2 }, { id: BW })).toBe('12 (RIR 2)') + }) }) 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('marks added weight as added', () => { + expect(exLine({ id: BW, sets: 3, reps: 8, weight: 10 }, 'kg')).toBe('3 × 8 · +10 kg') + }) it('summarises a planned exercise per mode', () => { expect(exLine({ id: LIFT, sets: 3, reps: 10 }, 'kg')).toBe('3 × 10') expect(exLine({ id: LIFT, sets: 3, reps: 10, weight: 60 }, 'kg')).toBe('3 × 10 · 60 kg') @@ -318,4 +369,14 @@ 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 }] }] } + expect(workoutVolume(w)).toBe(320) + }) + + it('leaves an unloaded bodyweight set at zero volume rather than inventing a number', () => { + const w = { entries: [{ id: BW, target: { bodyweight: true }, sets: [{ w: 0, r: 20, done: true }] }] } + expect(workoutVolume(w)).toBe(0) + }) }) diff --git a/frontend/src/lib/plan-share.js b/frontend/src/lib/plan-share.js index fc595b3..bb69e91 100644 --- a/frontend/src/lib/plan-share.js +++ b/frontend/src/lib/plan-share.js @@ -8,8 +8,8 @@ // 2. A clean, printable page (Save as PDF) where a single exercise never splits across // a page break — each exercise, and each routine that fits, stays in one place. -import { EXIDX } from './exercises.js' -import { modeOf, fmtSec } from './history.js' +import { EXIDX, isBodyweightEq } from './exercises.js' +import { modeOf, fmtSec, isBw, repLabel } from './history.js' import { uid, todayISO, DAYN, fmtNum, exCount } from './format.js' import { t } from './i18n.js' @@ -33,11 +33,16 @@ function cleanEx(e) { if (e.reps != null) o.reps = e.reps if (e.weight) o.weight = e.weight } + // How the exercise is logged travels too (issues #31/#32) — the bodyweight flag only when + // it disagrees with the catalogue, since agreeing is what the other end already assumes. + if (e.bodyweight != null && e.bodyweight !== isBodyweightEq(e.id)) o.bodyweight = e.bodyweight + if (e.side) o.side = true // Progression settings travel with the plan — a shared Greyskull routine that arrives // without its rule is just a list of weights. if (e.prog) o.prog = e.prog if (e.inc > 0) o.inc = e.inc if (e.repsMin != null) o.repsMin = e.repsMin + if (e.repsMax != null) o.repsMax = e.repsMax if (e.sg) o.sg = e.sg return o } @@ -144,8 +149,8 @@ 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} × ${e.reps ?? 10}` - if (e.weight) s += ` · ${fmtNum(e.weight)} ${unit}` + let s = mode === 'time' ? `${sets} × ${fmtSec(e.sec || 45)}` : `${sets} × ${repLabel(e, e.reps ?? 10)}` + if (e.weight) s += ` · ${isBw(e) ? '+' : ''}${fmtNum(e.weight)} ${unit}` return s } diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.js index dd950b7..bb4dab3 100644 --- a/frontend/src/lib/progression.js +++ b/frontend/src/lib/progression.js @@ -60,6 +60,9 @@ export function defaultIncrement(exId, unit) { return heavy ? 5 : 2.5 } export const DEFAULT_SEC_INCREMENT = 5 +// Where adding another set of push-ups stops being progress and starts being a way to spend +// an evening. Past this the honest advice is load or a harder variation (issue #33). +export const MAX_BW_SETS = 6 // The policy in force for one exercise: its own override, else the routine's default, else // the mode's default. Reps keeps behaving the way the app always did (all reps → add a step). @@ -117,6 +120,7 @@ export function readSession(entry, fallback) { return { mode, goal, reps, weight: Math.max(0, ...sets.filter(s => s.done).map(s => s.w || 0)), + count: reps.length, // the dimension bodyweight work grows (#33) low: reps.length ? Math.min(...reps) : 0, amrap: reps.length ? reps[reps.length - 1] : 0, // Greyskull's final set ok: goal > 0 && enough && reps.length > 0 && reps.every(r => r >= goal) @@ -179,14 +183,26 @@ export function nextPrescription(S, cfg, routine) { const w = last.weight // Bodyweight work carries no external load, so there is nothing to add or take away — - // "deload your push-ups to 2.5 kg" is not advice. Progress in reps instead. This runs - // ahead of the individual policies because it is true for all of them; a rep range set on - // top of it simply gets passed once you exceed it, which is the right moment to add load - // or move to a harder variation anyway. + // "deload your push-ups to 2.5 kg" is not advice. Progress in reps instead. This runs ahead + // of the individual policies because it is true for all of them. Note the trigger is the + // *logged* weight, not the `bw` flag: a dip done with a belt has a load to progress and + // belongs on the normal policies, and a barbell lift logged at 0 has nothing to add to. if (w <= 0) { const goal = last.goal || cfg.reps || 0 - if (last.ok && goal > 0) return { policy, kind: 'up', weight: 0, reps: goal + 1, why: ['Bodyweight — every rep last time, so go for {0} this time.', goal + 1] } - return { policy, kind: 'hold', weight: 0, reps: goal || undefined, why: ['Bodyweight — same target again until every set is clean.'] } + if (!last.ok || goal <= 0) return { policy, kind: 'hold', weight: 0, reps: goal || undefined, why: ['Bodyweight — same target again until every set is clean.'] } + // A ceiling turns "+1 rep forever" into a plan (issue #33). Past the top of the range the + // reps go back to the bottom and a set is added instead, which is how bodyweight work + // actually progresses once a set of 30 push-ups stops being a strength stimulus. + const top = cfg.repsMax > 0 ? cfg.repsMax : 0 + if (top > 0 && goal >= top) { + const sets = Math.max(1, cfg.sets || last.count || 1) + 1 + const bottom = Math.max(1, Math.min(cfg.reps || top, top)) + if (sets <= MAX_BW_SETS) return { policy, kind: 'up', weight: 0, reps: bottom, sets, why: ['{0} reps in every set — add a set and go back to {1}.', goal, bottom] } + // Out of sets worth adding: more volume is no longer the answer, load or a harder + // 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] } } if (policy === 'double') { const top = cfg.reps || last.goal || 10 @@ -231,12 +247,20 @@ export function nextPrescription(S, cfg, routine) { */ export function applyPrescription(sets, p) { if (!p || p.kind === 'off' || p.kind === 'first') return sets - return sets.map(s => { + const out = sets.map(s => { if (s.done) return s - const out = { ...s } - if (p.weight != null) out.w = p.weight - if (p.reps != null) out.r = p.reps - if (p.sec != null) out.sec = p.sec - return out + const o = { ...s } + if (p.weight != null) o.w = p.weight + if (p.reps != null) o.r = p.reps + if (p.sec != null) o.sec = p.sec + return o }) + // A policy that decided on a set count gets to grow the list — bodyweight progression adds + // a set where a barbell would have added a plate. Only ever upwards, and only by copying a + // row that is already there: a session in progress must not lose a set it has logged. + if (p.sets > out.length) { + const seed = out[out.length - 1] + while (out.length < p.sets) out.push({ ...seed, done: false }) + } + return out } diff --git a/frontend/src/lib/progression.test.js b/frontend/src/lib/progression.test.js index 9847ec9..9901edf 100644 --- a/frontend/src/lib/progression.test.js +++ b/frontend/src/lib/progression.test.js @@ -1,7 +1,7 @@ import { describe, it, expect } from 'vitest' import { readSession, sessionsFor, stallCount, nextPrescription, applyPrescription, - policyFor, defaultIncrement, POLICIES_FOR, DELOAD_AFTER + policyFor, defaultIncrement, POLICIES_FOR, DELOAD_AFTER, MAX_BW_SETS } from './progression.js' import { EXDB } from './exercises.js' @@ -189,6 +189,47 @@ describe('bodyweight exercises', () => { expect(p.reps).toBe(11) }) + /* A ceiling turns "+1 rep forever" into a plan — issue #33. */ + it('climbs to the ceiling one rep at a time', () => { + const p = nextPrescription(bw([[0, 10, 10, 10]]), { ...cfg, repsMax: 15 }) + expect(p.kind).toBe('up') + expect(p.reps).toBe(11) + expect(p.sets).toBeUndefined() + }) + + it('adds a set and restarts the range once the ceiling is reached', () => { + const at15 = hist(LIFT, [[0, 15, 15, 15]], { sets: 3, reps: 15 }) + const p = nextPrescription(at15, { ...cfg, reps: 10, repsMax: 15 }) + expect(p.kind).toBe('up') + expect(p.sets).toBe(4) + expect(p.reps).toBe(10) + expect(p.weight).toBe(0) + }) + + it('stops adding sets at the cap and says what to do instead', () => { + const at15 = hist(LIFT, [[0, 15, 15, 15]], { sets: 3, reps: 15 }) + const p = nextPrescription(at15, { ...cfg, sets: MAX_BW_SETS, reps: 10, repsMax: 15 }) + expect(p.kind).toBe('hold') + expect(p.sets).toBeUndefined() + expect(p.why[0]).toMatch(/harder variation/) + }) + + it('leaves a belted set to the normal policies — there is a load to add now', () => { + const belted = hist(LIFT, [[10, 10, 10, 10]], { sets: 3, reps: 10 }) + const p = nextPrescription(belted, { ...cfg, bodyweight: true, repsMax: 15 }) + expect(p.kind).toBe('up') + expect(p.weight).toBeGreaterThan(10) + expect(p.sets).toBeUndefined() + }) + + 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) + expect(p.kind).toBe('up') + expect(p.reps).toBe(31) + expect(p.sets).toBeUndefined() + }) + it('applies to every policy, not just linear', () => { for (const prog of ['linear', 'greyskull', 'double']) { const p = nextPrescription(bw([[0, 10, 10, 4], [0, 10, 10, 4], [0, 10, 10, 4]]), { ...cfg, prog }) @@ -390,4 +431,15 @@ describe('applyPrescription', () => { const timed = [{ sec: 45, w: 0, done: false }] expect(applyPrescription(timed, { kind: 'up', sec: 50 })).toEqual([{ sec: 50, w: 0, done: false }]) }) + + it('grows the list when the policy added a set (issue #33)', () => { + const three = [{ w: 0, r: 10, done: false }, { w: 0, r: 10, done: false }, { w: 0, r: 10, done: false }] + const out = applyPrescription(three, { kind: 'up', weight: 0, reps: 10, sets: 4 }) + expect(out).toHaveLength(4) + expect(out[3]).toEqual({ w: 0, r: 10, done: false }) + }) + + it('never shrinks a session that has already logged sets', () => { + expect(applyPrescription(sets, { kind: 'up', weight: 60, sets: 1 })).toHaveLength(sets.length) + }) }) diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js index 853c67c..31a197d 100644 --- a/frontend/src/locales/de.js +++ b/frontend/src/locales/de.js @@ -555,4 +555,23 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'Die meisten Arbeitssätze gehören nah ans Muskelversagen, ohne dort zu wohnen — die Hälfte ganz unten und die Hälfte ganz oben mittelt sich zu einem gesund aussehenden Mittelwert.', 'Average effort per workout': 'Durchschnittliche Anstrengung pro Training', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Ein vollerer Punkt heißt: weniger im Tank — dasselbe Gewicht bei niedrigerem {0} ist Fortschritt, den die Linie allein nicht zeigt.', + // --- bodyweight & per side --- + 'Bodyweight': 'Körpergewicht', + 'No weight to enter — just log the reps.': 'Kein Gewicht einzutragen — nur die Wiederholungen.', + 'Ask for a weight on every set.': 'Bei jedem Satz nach dem Gewicht fragen.', + 'Added weight': 'Zusatzgewicht', + '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.', } diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js index 3c83ce6..2bd31b5 100644 --- a/frontend/src/locales/es.js +++ b/frontend/src/locales/es.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'La mayoría de las series efectivas van cerca del fallo sin vivir allí — la mitad abajo y la mitad arriba dan una media que solo parece sana.', 'Average effort per workout': 'Esfuerzo medio por entrenamiento', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Un punto más lleno significa menos reserva — el mismo peso con un {0} más bajo es progreso que la línea por sí sola no muestra.', + + // --- bodyweight & per side --- + 'Bodyweight': 'Peso corporal', + 'No weight to enter — just log the reps.': 'No hay peso que introducir — solo registra las reps.', + 'Ask for a weight on every set.': 'Pedir un peso en cada serie.', + 'Added weight': 'Peso extra', + '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.', } diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js index 3d0a03d..35b24f6 100644 --- a/frontend/src/locales/fr.js +++ b/frontend/src/locales/fr.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'La plupart des séries de travail se placent près de l’échec sans y vivre — la moitié tout en bas et la moitié tout en haut donnent une moyenne qui n’a l’air saine que sur le papier.', 'Average effort per workout': 'Effort moyen par séance', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Un point plus plein veut dire moins de réserve — le même poids à un {0} plus bas, c’est un progrès que la ligne seule ne montre pas.', + + // --- bodyweight & per side --- + 'Bodyweight': 'Poids du corps', + 'No weight to enter — just log the reps.': 'Pas de poids à saisir — note simplement les répétitions.', + 'Ask for a weight on every set.': 'Demander un poids à chaque série.', + 'Added weight': 'Poids ajouté', + '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.', } diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js index 08e3bdf..f606dde 100644 --- a/frontend/src/locales/hi.js +++ b/frontend/src/locales/hi.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'ज़्यादातर वर्किंग सेट फेलियर के पास होने चाहिए, पर वहीं बसे नहीं — आधे सबसे नीचे और आधे सबसे ऊपर मिलकर एक ऐसा औसत बनाते हैं जो सिर्फ़ देखने में सेहतमंद लगता है।', 'Average effort per workout': 'हर वर्कआउट की औसत मेहनत', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'ज़्यादा भरा बिंदु मतलब टंकी में कम बचा — वही वज़न कम {0} पर उठाना वह प्रगति है जो अकेली लाइन नहीं दिखाती।', + + // --- bodyweight & per side --- + 'Bodyweight': 'बॉडीवेट', + 'No weight to enter — just log the reps.': 'कोई वज़न नहीं डालना — बस रेप्स दर्ज करें।', + 'Ask for a weight on every set.': 'हर सेट पर वज़न पूछें।', + 'Added weight': 'अतिरिक्त वज़न', + '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} सेट — अब वज़न बढ़ाने या किसी कठिन वैरिएशन पर जाने का समय।', } diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js index e4ef22b..3e7e469 100644 --- a/frontend/src/locales/it.js +++ b/frontend/src/locales/it.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'La maggior parte delle serie di lavoro sta vicino al cedimento senza viverci — metà in fondo e metà in cima danno una media che sembra sana solo all’apparenza.', 'Average effort per workout': 'Sforzo medio per allenamento', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Un punto più pieno significa meno riserva — lo stesso peso con un {0} più basso è progresso che la linea da sola non mostra.', + + // --- bodyweight & per side --- + 'Bodyweight': 'Corpo libero', + 'No weight to enter — just log the reps.': 'Nessun peso da inserire — registra solo le ripetizioni.', + 'Ask for a weight on every set.': 'Chiedi un peso a ogni serie.', + 'Added weight': 'Peso aggiunto', + '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.', } diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js index e5c485c..cee5d93 100644 --- a/frontend/src/locales/ko.js +++ b/frontend/src/locales/ko.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': '대부분의 본세트는 실패 지점 가까이에 있어야 하지만 거기 머물면 안 됩니다 — 절반은 바닥에 절반은 꼭대기에 있으면 평균만 건강해 보입니다.', 'Average effort per workout': '운동당 평균 강도', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': '점이 진할수록 남은 여력이 적다는 뜻입니다 — 같은 무게를 더 낮은 {0}로 든 것은 선만 봐서는 알 수 없는 발전입니다.', + + // --- bodyweight & per side --- + 'Bodyweight': '맨몸 운동', + 'No weight to enter — just log the reps.': '입력할 무게 없음 — 횟수만 기록합니다.', + 'Ask for a weight on every set.': '세트마다 무게를 물어봅니다.', + 'Added weight': '추가 무게', + '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}세트 — 이제 무게를 올리거나 더 어려운 동작으로 넘어가세요.', } diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js index a4704ba..c091ed0 100644 --- a/frontend/src/locales/pl.js +++ b/frontend/src/locales/pl.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'Większość serii roboczych należy blisko upadku, ale nie na nim — połowa na dole i połowa na górze uśrednia się do zdrowo wyglądającego środka.', 'Average effort per workout': 'Średni wysiłek na trening', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Pełniejsza kropka znaczy mniej zapasu — ten sam ciężar przy niższym {0} to postęp, którego sama linia nie pokazuje.', + + // --- bodyweight & per side --- + 'Bodyweight': 'Masa własna', + 'No weight to enter — just log the reps.': 'Nie podajesz ciężaru — zapisujesz tylko powtórzenia.', + 'Ask for a weight on every set.': 'Pytaj o ciężar przy każdej serii.', + 'Added weight': 'Dodatkowy ciężar', + '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.', } diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js index 64ad262..3534e21 100644 --- a/frontend/src/locales/pt.js +++ b/frontend/src/locales/pt.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'A maioria das séries de trabalho fica perto da falha sem viver lá — metade no fundo e metade no topo dão uma média que só parece saudável.', 'Average effort per workout': 'Esforço médio por treino', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Um ponto mais cheio significa menos margem — o mesmo peso com um {0} mais baixo é progresso que a linha sozinha não mostra.', + + // --- bodyweight & per side --- + 'Bodyweight': 'Peso do corpo', + 'No weight to enter — just log the reps.': 'Sem peso para introduzir — regista só as repetições.', + 'Ask for a weight on every set.': 'Pedir um peso em cada série.', + 'Added weight': 'Peso extra', + '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.', } diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js index 94b061b..7d05fed 100644 --- a/frontend/src/locales/ru.js +++ b/frontend/src/locales/ru.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'Большинство рабочих подходов должны идти близко к отказу, но не жить на нём — половина внизу и половина вверху дают среднее, которое лишь выглядит здоровым.', 'Average effort per workout': 'Среднее усилие за тренировку', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Более плотная точка означает меньше запаса — тот же вес при меньшем {0} это прогресс, которого одна линия не показывает.', + + // --- bodyweight & per side --- + 'Bodyweight': 'Собственный вес', + 'No weight to enter — just log the reps.': 'Вес вводить не нужно — записывай только повторения.', + 'Ask for a weight on every set.': 'Спрашивать вес в каждом подходе.', + 'Added weight': 'Дополнительный вес', + '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} — пора добавить вес или перейти к более сложному варианту.', } diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js index 7e773d1..1dbd6bf 100644 --- a/frontend/src/locales/tr.js +++ b/frontend/src/locales/tr.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': 'Çalışma setlerinin çoğu tükenmeye yakın olmalı ama orada yaşamamalı — yarısı en altta yarısı en üstte, ortalaması sağlıklı görünür.', 'Average effort per workout': 'Antrenman başına ortalama zorluk', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': 'Daha dolu bir nokta depoda daha az kaldı demek — aynı ağırlığı daha düşük {0} ile kaldırmak, çizginin tek başına göstermediği bir ilerlemedir.', + + // --- bodyweight & per side --- + 'Bodyweight': 'Vücut ağırlığı', + 'No weight to enter — just log the reps.': 'Girilecek ağırlık yok — sadece tekrarları kaydet.', + 'Ask for a weight on every set.': 'Her sette ağırlık sorulsun.', + 'Added weight': 'Ek ağırlık', + '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ı.', } diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js index 051fcf0..fcaddf3 100644 --- a/frontend/src/locales/zh.js +++ b/frontend/src/locales/zh.js @@ -537,4 +537,24 @@ export default { 'Most working sets belong close to failure without living there — half at the floor and half at the top average out to a healthy-looking middle.': '大多数正式组应该接近力竭,但不要一直待在那里——一半在最底、一半在最顶,平均下来只是看着健康。', 'Average effort per workout': '每次训练的平均强度', 'A fuller dot means less left in the tank — the same weight at a lower {0} is progress the line alone does not show.': '点越实,油箱里剩得越少——同样的重量配上更低的 {0},是曲线本身看不出的进步。', + + // --- bodyweight & per side --- + 'Bodyweight': '徒手动作', + 'No weight to enter — just log the reps.': '无需输入重量——只记录次数。', + 'Ask for a weight on every set.': '每组都询问重量。', + 'Added weight': '额外负重', + '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} 次——该加重量或换更难的变式了。', } diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx index f815fc4..0efe6a3 100644 --- a/frontend/src/sheets.jsx +++ b/frontend/src/sheets.jsx @@ -1,9 +1,9 @@ import { useEffect, useRef, useState } from 'react' import { useStore } from './store/useStore.js' import { useUI } from './store/useUI.js' -import { EXDB, EXIDX, BODYPARTS, isCardio, allExercises, equipmentOf } from './lib/exercises.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 } from './lib/history.js' +import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, isBw, isPerSide } 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' @@ -11,14 +11,14 @@ import { starterRoutines } from './lib/starter.js' import Media, { Thumb } from './components/Media.jsx' import Stepper from './components/Stepper.jsx' import Icon from './components/Icon.jsx' -import { Button, Slider, Switch, Segmented, SelectRow } from './components/ui.jsx' +import { Button, Slider, Switch, Segmented, SelectRow, Row } from './components/ui.jsx' import { glyphOf, GLYPH_GROUPS, DEFAULT_GLYPH } from './lib/glyphs.js' import BodyMap from './components/BodyMap.jsx' import { loadOfWorkouts } from './lib/muscles.js' import { parseImport, mergeImport } from './lib/import-csv.js' import { buildPlanBundle, parsePlan, mergePlan, printPlan } from './lib/plan-share.js' import { estimate1RM, best1RM, is1RMRecord, REP_CAP } from './lib/onerm.js' -import { nextPrescription, applyPrescription, policyFor, defaultIncrement, POLICIES_FOR, POLICY_NAME, POLICY_DESC } from './lib/progression.js' +import { nextPrescription, applyPrescription, policyFor, defaultIncrement, POLICIES_FOR, POLICY_NAME, POLICY_DESC, MAX_BW_SETS } from './lib/progression.js' import { MOBILE, shareExport } from './lib/mobile.js' const S = () => useStore.getState().S @@ -489,6 +489,9 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) { // Cardio keeps its own duration+speed form; the reps/time choice (issue #16) is offered for // everything else, which is where the gap was — planks, hangs, wall sits, loaded carries. const mode = cardio ? 'cardio' : modeOf({ ...c, id: ex.id }) + // Both default from the dataset and are then whatever the config says — see isBw. + const bw = !cardio && isBw({ ...c, id: ex.id }) + const perSide = isPerSide(c) // Keep whatever the other mode already had (sets, weight) and fill only what is missing. const setMode = m => setC(x => ({ ...defaultConfig(ex.id, m), ...x, mode: m })) const save = () => { @@ -499,12 +502,19 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) { const prog = {} if (c.prog) prog.prog = c.prog if (c.inc > 0) prog.inc = c.inc + // Written only when it differs from what the dataset already says, so a barbell config + // stays exactly the shape it was before these flags existed. + const flags = {} + if (bw !== isBodyweightEq(ex.id)) flags.bodyweight = bw + if (perSide) flags.side = true 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), ...prog }) + 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) - const out = { sets, mode: 'reps', reps, weight: Math.max(0, c.weight || 0), ...prog } + 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. + if (bw && !(out.weight > 0) && c.repsMax > 0) out.repsMax = Math.max(reps, Math.round(c.repsMax)) onSave(out) } } @@ -532,12 +542,39 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine }) { : <> setC(x => ({ ...x, sets: v }))} /> setC(x => ({ ...x, reps: v }))} /> - setC(x => ({ ...x, weight: 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 }))} />} } - {mode === 'time' &&
+ {mode === 'time' && !bw &&
{t('A timer runs while you hold the set. Leave the weight at 0 for bodyweight holds.')}
} + {/* ---------- bodyweight + per side (issues #31/#32/#33) ---------- */} + {!cardio &&
+ + setC(x => ({ ...x, bodyweight: v, weight: v ? 0 : x.weight }))} /> + + {bw && + setC(x => ({ ...x, weight: v }))} /> + } + {mode === 'reps' && + setC(x => ({ ...x, side: v || undefined }))} /> + } +
} + {/* The rep ceiling only means something when there is no load to add instead. */} + {mode === 'reps' && bw && !(c.weight > 0) &&
+ setC(x => ({ ...x, repsMax: v }))} /> +
} + {mode === 'reps' && bw && !(c.weight > 0) &&
+ {c.repsMax > 0 + ? t('Reps climb to {0}, then a set is added and the reps start over. At {1} sets it asks you to add weight instead.', c.repsMax, MAX_BW_SETS) + : t('Reps climb by one whenever every set was clean. Set a ceiling to add sets instead of reps forever.')} +
} {ex.custom && <>
} diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx index 3e50f98..ace7a7d 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, EFFORT, effortOf, stepEffort, capEffort } from '../lib/history.js' +import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, totalReps, 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' @@ -69,12 +69,20 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov // What the progression policy decided for this session, and why (issue #17). Computed when // the session was built so the reason matches the numbers already in the rows. const plan = entry.plan + // A bodyweight set has no weight to type, so the column is not there (issue #32) — one + // stepper instead of two, which is the whole point of the flag. Adding a belt weight in the + // config brings it back, now labelled as the addition it is. + const cfg = { ...(entry.target || {}), id: entry.id } + 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') } const col1 = cardio ? { f: 'min', step: 1, dec: false, hd: t('Duration (min)') } : timed ? { f: 'sec', step: 5, dec: false, hd: t('Seconds') } - : { f: 'w', step: 2.5, dec: true, hd: t('Weight ({0})', S.unit) } + : (bw && !added) ? repCol : loadCol 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') } + : timed ? ((bw && !added) ? null : loadCol) + : (bw && !added) ? null : repCol // 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. @@ -106,6 +114,8 @@ 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)}} {(ex.tg || ex.bp) && {t(ex.tg || ex.bp)}} {ex.eq && {t(ex.eq)}} {best > 0 && {t('Best:')} {fmtNum(best)} {S.unit}} @@ -117,11 +127,11 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onAddSet, onRemov
}
{/* the header carries the same eff3 sizing as the rows, or the labels drift off their columns */} -
{col1.hd}{col2.hd}{col3 && {col3.hd}}{timed && }
+
{col1.hd}{col2 && {col2.hd}}{col3 && {col3.hd}}{timed && }
{entry.sets.map((s, i) =>
{i + 1}
{cell(s, i, col1, 'w')} - {cell(s, i, col2, 'r')} + {col2 && cell(s, i, col2, 'r')} {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. */} @@ -196,9 +206,11 @@ function ActiveWorkout() { if (isLastExInUnit && !unitDone) startRest(S.restSec) else if (unitDone) stopRest() if (unitDone && isLastUnit) workoutDone = true // last exercise's last set → done - // Only reps training has a "working weight" worth confirming — a bodyweight plank - // has nothing to put in that slider. - if (e.sets.every(x => x.done)) { exJustDone = true; if (m === 'reps' && !e.asked) { e.asked = true; askTop = true } } + // Only loaded reps training has a "working weight" worth confirming — a bodyweight + // plank has nothing to put in that slider, and neither does a set of push-ups + // (issue #32: the fewest taps that still record what happened). + const loaded = m === 'reps' && !(isBw({ ...(e.target || {}), id: e.id }) && !e.sets.some(x => x.w > 0)) + if (e.sets.every(x => x.done)) { exJustDone = true; if (loaded && !e.asked) { e.asked = true; askTop = true } } } }) // reps: topWeight first (it chains into the finish/continue prompt on the last unit).