Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Assistance machines run the other way round: less help is the record, and the plan takes help away (#232)
Duarte Santosf7b9a80a9370
diff --git a/frontend/src/lib/assisted.test.js b/frontend/src/lib/assisted.test.jsnew file mode 100644index 000000000..252231e1c--- /dev/null+++ b/frontend/src/lib/assisted.test.js@@ -0,0 +1,93 @@+// Issue #232: an assistance machine carries part of your body weight, so LESS load is the+// harder set, the record, and what progression should aim for. The reporter's case: 30 kg of+// assistance, then 20 kg — the 20 is the new best, and the next session should ask for less.+import { describe, it, expect } from 'vitest'+import { isAssisted, betterWeight, beatsWeight, EXIDX } from './exercises.js'+import { bestWeightFor, bestWeightForEntry } from './history.js'+import { readSession, nextPrescription } from './progression.js'+import { bestSetOf, e1rmSeries, is1RMRecord } from './onerm.js'++const ASSISTED = '0017' // assisted pull-up, leverage machine+const PLAIN = '0025' // barbell bench press+const set = (w, r, done = true) => ({ w, r, done })+const workout = (d, id, sets) => ({ d, start: Date.parse(d + 'T10:00:00Z'), entries: [{ id, target: { mode: 'reps', sets: 1, reps: 8, weight: sets[0].w }, sets }] })++describe('which exercises count as assisted', () => {+ it('takes the leverage machine whose name says assisted, and nothing else', () => {+ expect(isAssisted(ASSISTED)).toBe(true)+ expect(EXIDX[ASSISTED].eq).toBe('leverage machine')+ expect(isAssisted(PLAIN)).toBe(false)+ // a partner holding your legs, a medicine ball, a band, your own body — ordinary load+ for (const id of ['0011', '1708', '0014', '0970', '0697']) expect(isAssisted(id), id).toBe(false)+ })++ it('lets an exercise or a routine config say so outright', () => {+ expect(isAssisted({ id: PLAIN, assisted: true })).toBe(true)+ expect(isAssisted({ id: ASSISTED, assisted: false })).toBe(false)+ expect(isAssisted({ id: PLAIN, target: { assisted: true } })).toBe(true)+ expect(isAssisted({ n: 'My gym’s assisted dip', eq: 'leverage machine' })).toBe(true)+ })++ it('folds and compares loads the right way round', () => {+ expect(betterWeight(ASSISTED, 30, 20)).toBe(20)+ expect(betterWeight(PLAIN, 30, 20)).toBe(30)+ expect(beatsWeight(ASSISTED, 20, 30)).toBe(true)+ expect(beatsWeight(ASSISTED, 40, 30)).toBe(false)+ expect(beatsWeight(ASSISTED, 30, 0)).toBe(true) // nothing logged yet+ expect(beatsWeight(ASSISTED, 0, 30)).toBe(false) // no load logged is not a record+ })+})++describe('the record is the lightest assistance', () => {+ const S = { unit: 'kg', workouts: [workout('2026-09-01', ASSISTED, [set(30, 8)]), workout('2026-09-08', ASSISTED, [set(20, 8)])] }++ it('reports the smallest load as the best, across history and within a session', () => {+ expect(bestWeightFor(S, ASSISTED)).toBe(20)+ expect(bestWeightForEntry({ id: ASSISTED, sets: [set(30, 8), set(20, 8)] })).toBe(20)+ expect(bestWeightForEntry({ id: PLAIN, sets: [set(30, 8), set(20, 8)] })).toBe(30)+ })++ it('ignores an unlogged load instead of calling 0 the best', () => {+ expect(bestWeightForEntry({ id: ASSISTED, sets: [set(0, 8), set(25, 8)] })).toBe(25)+ })+})++describe('progression asks for less help', () => {+ const cfg = { id: ASSISTED, sets: 1, reps: 8, weight: 30, prog: 'linear', inc: 5 }+ const hist = w => ({ unit: 'kg', workouts: [{ d: '2026-09-08', start: 1, entries: [{ id: ASSISTED, target: { ...cfg, weight: w }, sets: [set(w, 8)] }] }] })++ it('takes assistance away after a clean session', () => {+ const p = nextPrescription(hist(30), cfg)+ expect(p.kind).toBe('up')+ expect(p.weight).toBe(25)+ expect(p.why.join(' ')).toMatch(/less help/)+ })++ it('never goes below no assistance at all', () => {+ const p = nextPrescription(hist(5), { ...cfg, weight: 5 })+ expect(p.weight).toBeGreaterThanOrEqual(0)+ })++ it('reads the lightest completed set as the session load', () => {+ const read = readSession({ id: ASSISTED, target: { mode: 'reps', sets: 2, reps: 8 }, sets: [set(30, 8), set(20, 8)] })+ expect(read.weight).toBe(20)+ })++ it('still adds weight on an ordinary lift', () => {+ const plain = { id: PLAIN, sets: 1, reps: 8, weight: 60, prog: 'linear', inc: 5 }+ const S = { unit: 'kg', workouts: [{ d: '2026-09-08', start: 1, entries: [{ id: PLAIN, target: plain, sets: [set(60, 8)] }] }] }+ expect(nextPrescription(S, plain).weight).toBe(65)+ })+})++describe('no one-rep max for an assistance machine', () => {+ it('leaves it out of the estimate, the curve and the record check', () => {+ const entry = { id: ASSISTED, sets: [set(30, 8)] }+ expect(bestSetOf(entry)).toBe(null)+ const S = { unit: 'kg', workouts: [workout('2026-09-01', ASSISTED, [set(30, 8)])] }+ expect(e1rmSeries(S, ASSISTED)).toEqual([])+ expect(is1RMRecord(S, ASSISTED, entry)).toBe(null)+ // the ordinary lift still gets one+ expect(bestSetOf({ id: PLAIN, sets: [set(100, 5)] })).not.toBe(null)+ })+})diff --git a/frontend/src/lib/exercises.js b/frontend/src/lib/exercises.jsindex 3523d666b..d2ecc221c 100644--- a/frontend/src/lib/exercises.js+++ b/frontend/src/lib/exercises.js@@ -149,6 +149,44 @@ const BODYWEIGHT_EQ = new Set(['body weight', 'band', 'resistance band'])export const isBodyweightEq = idOrEx =>BODYWEIGHT_EQ.has((typeof idOrEx === 'string' ? EXIDX[idOrEx] : idOrEx)?.eq)+/* Assistance machines run the other way round: the stack carries part of your body weight, so+ * a smaller number is the harder set and the record (issue #232). Getting the set wrong is+ * worse than not having the feature — inverting a normal lift would hide real progress — so the+ * rule is deliberately narrow: the machine that takes load off you is the leverage machine whose+ * name says "assisted". That is eight exercises in the catalogue (assisted pull-up, chin-up,+ * chest dip, triceps dip and their variants) and nothing else.+ *+ * The name alone is not enough. Twenty-nine catalogue entries say "assisted": partner-assisted+ * stretches, a medicine-ball twist, band and bodyweight leg curls. On those the weight is+ * ordinary load — heavier is harder — and inverting them would be the same bug pointed the+ * other way. Equipment is what separates the two.+ *+ * `assisted: true` (or `false`) on a custom exercise or on a routine's config overrides the+ * rule in either direction, which is how anything the catalogue does not know gets marked.+ */+const ASSISTED_EQ = 'leverage machine'+const assistedName = n => /\bassist(ed)?\b/i.test(String(n || ''))++// The catalogue entry itself carries an `id`, so this never recurses through it — one lookup,+// then the shape is read directly.+const assistedShape = ex => (typeof ex?.assisted === 'boolean' ? ex.assisted : ex?.eq === ASSISTED_EQ && assistedName(ex?.n))++export function isAssisted(idOrEx) {+ if (!idOrEx) return false+ if (typeof idOrEx === 'string') return !!assistedShape(EXIDX[idOrEx])+ if (typeof idOrEx.assisted === 'boolean') return idOrEx.assisted+ if (typeof idOrEx.target?.assisted === 'boolean') return idOrEx.target.assisted+ const known = idOrEx.id ? EXIDX[idOrEx.id] : null+ return !!assistedShape(known || idOrEx)+}++/** The better of two loads for this exercise: less assistance, or more weight. */+export const betterWeight = (idOrEx, a, b) => (isAssisted(idOrEx) ? Math.min(a, b) : Math.max(a, b))++/** Is `w` a better load than `prev`? `prev` of 0 means nothing logged yet. */+export const beatsWeight = (idOrEx, w, prev) =>+ w > 0 && (prev <= 0 || (isAssisted(idOrEx) ? w < prev : w > prev))+// 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 viewdiff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.jsindex ce3e19b89..2ebbc0683 100644--- a/frontend/src/lib/history.js+++ b/frontend/src/lib/history.js@@ -1,6 +1,6 @@// Pure helpers over the state object S (ported 1:1 from the vanilla app).import { todayISO, isoOf, weekKey, weekStartOf, fmtNum } from './format.js'-import { isCardio, isBodyweightEq } from './exercises.js'+import { isCardio, isBodyweightEq, isAssisted, betterWeight } from './exercises.js'import { phaseForSet, modeForSet, modeForEntry, isWarmupRow, normalizeMode, completedVolumeOf, nextDropWeight, splitBurstReps, makeSideSet, isSideSet, syncSideAggregate } from './workout-model.js'const objectOf = value => value && typeof value === 'object' && !Array.isArray(value) ? value : {}// Completed-state-independent work rows whose authoritative mode matches the requested mode.@@ -297,9 +297,12 @@ export function freestyleConfig(S, cfg) {}}export function bestWeightFor(S, exId) {+ // 0 means "nothing logged with a load yet" and must not win a min() for an assisted machine.let best = 0S.workouts.forEach(w => w.entries.forEach(e => {- if (e.id === exId) best = Math.max(best, bestWeightForEntry(e))+ if (e.id !== exId) return+ const entryBest = bestWeightForEntry(e)+ if (entryBest > 0) best = best > 0 ? betterWeight(exId, best, entryBest) : entryBest}))return best}@@ -717,13 +720,21 @@ export function bestWeightForEntry(entry = {}) {const completedRows = repsRows.length? repsRows: workRows.filter(set => set?.done === true && !isWarmupRow(set))+ // On an assistance machine the smallest load is the best set, so "best" folds the other way+ // (issue #232). Everything below still returns a plain number — the caller does not branch.+ const assisted = isAssisted(entry.id ? { id: entry.id } : entry)let best = 0let hasUsableWeight = falsecompletedRows.forEach(set => {const weight = Number(set?.w)if (!Number.isFinite(weight)) return+ // A 0 on an assistance machine is a row with no load entered, not a set done with no help+ // at all — folding it in as "the least assistance ever" would invent a record nobody did+ // and then ask for negative help next time. Anyone truly needing none has left the machine+ // behind and should log the unassisted exercise instead.+ if (assisted && !(weight > 0)) return+ best = hasUsableWeight ? betterWeight(entry.id, best, weight) : weighthasUsableWeight = true- if (weight > best) best = weight})// A real completed row, including an explicit zero for an unloaded bodyweight set, always@@ -736,7 +747,7 @@ export function bestWeightForEntry(entry = {}) {const topWeight = Number(entry.topW)// topW predates phase-tagged warm-ups. It remains a fallback for legacy all-work records,// but cannot override resolved work rows once any warm-up marker exists.- if (parentMode === 'reps' && !hasNonRepsWorkRow && !hasWarmupRow- && Number.isFinite(topWeight) && topWeight > best) best = topWeight+ if (parentMode === 'reps' && !hasNonRepsWorkRow && !hasWarmupRow && Number.isFinite(topWeight)+ && (best <= 0 || (assisted ? topWeight > 0 && topWeight < best : topWeight > best))) best = topWeightreturn best}diff --git a/frontend/src/lib/onerm.js b/frontend/src/lib/onerm.jsindex 2602118e0..b96246fa1 100644--- a/frontend/src/lib/onerm.js+++ b/frontend/src/lib/onerm.js@@ -1,4 +1,5 @@import { isWarmupRow } from './workout-model.js'+import { isAssisted } from './exercises.js'// Estimated one-rep max (issue #18).//// Deliberately knows nothing about the exercise database: an estimate needs a weight AND a@@ -43,6 +44,10 @@ export function estimate1RM(w, r, formula = DEFAULT_FORMULA) {// `topW` is ignored on purpose: it records the working weight a user confirmed after the// exercise, with no rep count attached, so it cannot produce an estimate.export function bestSetOf(entry, formula = DEFAULT_FORMULA) {+ // An assistance machine has no one-rep max to estimate: the load is the help you were given,+ // so Epley on it would rise as you got weaker and call that a record (issue #232). These+ // exercises stay out of the estimate, the curve and the strength list entirely.+ if (isAssisted(entry?.id ? { id: entry.id } : entry)) return nulllet best = null;(entry?.sets || []).forEach(s => {if (!s.done || isWarmupRow(s)) return@@ -55,6 +60,7 @@ export function bestSetOf(entry, formula = DEFAULT_FORMULA) {// One point per workout in which the exercise produced an estimate — feeds the trend chart.// Chronological, matching the order workouts are appended in.export function e1rmSeries(S, exId, formula = DEFAULT_FORMULA) {+ if (isAssisted(exId)) return []const pts = [];(S.workouts || []).forEach(w => {const entry = w.entries.find(e => e.id === exId)diff --git a/frontend/src/lib/progression.js b/frontend/src/lib/progression.jsindex 48d94b08b..a665f499e 100644--- a/frontend/src/lib/progression.js+++ b/frontend/src/lib/progression.js@@ -17,7 +17,7 @@// So a session that fell apart can never advance the load as though it had succeeded.import { modeOf, repStep, rerampWarmups, isBw, isPerSide, entryExcluded } from './history.js'-import { EXIDX } from './exercises.js'+import { EXIDX, isAssisted } from './exercises.js'import { isWarmupRow, isSideSet, syncSideAggregate, makeSideSet } from './workout-model.js'import { normalizeRepRange } from './rep-range.js'@@ -214,6 +214,16 @@ export function selectDeloadCandidate({ currentWeight, targetWeight, targetReps,* entry without its own target is judged against `fallback`, the exercise's current plan,* which is exactly what the app's old weight hint compared against.*/+// The load the session is judged by. On an assistance machine less is harder, so the set that+// counts is the one with the least help — and a 0 there means "no load logged", not "best ever"+// (issue #232).+function loadOf(entry, sets) {+ const done = sets.filter(s => s.done).map(s => s.w || 0)+ if (!isAssisted(entry && entry.id ? { id: entry.id } : entry)) return Math.max(0, ...done)+ const loaded = done.filter(w => w > 0)+ return loaded.length ? Math.min(...loaded) : 0+}+export function readSession(entry, fallback) {const target = (entry && entry.target) || fallback || {}const mode = modeOf({ ...target, id: entry && entry.id })@@ -235,7 +245,7 @@ export function readSession(entry, fallback) {const held = sets.map(s => (s.done ? (s.sec || 0) : 0))return {mode, target, goal, held,- weight: Math.max(0, ...sets.filter(s => s.done).map(s => s.w || 0)),+ weight: loadOf(entry, sets),best: Math.max(0, ...held),ok: goal > 0 && enough && held.length > 0 && held.every(h => h >= goal)}@@ -244,7 +254,7 @@ export function readSession(entry, fallback) {const reps = sets.map(s => (s.done ? (s.r || 0) : 0))return {mode, target, goal, reps,- weight: Math.max(0, ...sets.filter(s => s.done).map(s => s.w || 0)),+ weight: loadOf(entry, sets),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@@ -313,6 +323,13 @@ export function nextPrescription(S, cfg, routine) {? (cfg.inc > 0 ? cfg.inc : DEFAULT_SEC_INCREMENT): weightIncrement(cfg, unit)if (policy === 'off') return { policy, kind: 'off' }+ // An assistance machine progresses downwards: the stack carries part of your weight, so the+ // reward for a clean session is less help, and a stall means taking more (issue #232). Only+ // the direction changes — the step, the grid and the stall counting are the same.+ const assisted = isAssisted(cfg)+ const harder = (weight, step) => (assisted ? Math.max(0, addStep(weight, -step, inc)) : addStep(weight, step, inc))+ const easier = weight => (assisted ? addStep(weight, inc, inc) : deloadTo(weight, inc))+const sessions = sessionsFor(S, cfg.id, cfg).filter(s => s.mode === mode)const last = sessions[sessions.length - 1]@@ -363,6 +380,8 @@ export function nextPrescription(S, cfg, routine) {// session that stalled (falling back field-by-field to the current config), while the logged// weight remains the hard upper bound for the selected candidate.const epleyDeload = () => {+ // Epley reads load as the work done; on an assistance machine it is the work taken away.+ if (assisted) return nullif (mode !== 'reps' || (policy !== 'linear' && policy !== 'double')) return nullconst previous = last.target || {}const target = {@@ -410,12 +429,22 @@ export function nextPrescription(S, cfg, routine) {const range = normalizeRepRange(cfg.reps || last.goal || 10, cfg.repsMin, repStep(cfg))const top = range.repsconst bottom = range.repsMin- if (last.ok) return { policy, kind: 'up', weight: addStep(w, inc, inc), reps: bottom, why: ['Top of the rep range in every set — {0} {1} more, back to {2} reps.', inc, unit, bottom] }+ if (last.ok) return {+ policy, kind: 'up', weight: harder(w, inc), reps: bottom,+ why: assisted+ ? ['Top of the rep range in every set — {0} {1} less help, back to {2} reps.', inc, unit, bottom]+ : ['Top of the rep range in every set — {0} {1} more, back to {2} reps.', inc, unit, bottom]+ }if (stalls >= deloadAt) {const selected = epleyDeload()if (selected) return selected- 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 dw = easier(w)+ return {+ policy, kind: 'deload', weight: dw, reps: bottom,+ why: assisted+ ? ['Stalled {0} sessions — back to {1} {2} of help and build up again.', stalls, dw, unit]+ : ['Stalled {0} sessions — deload to {1} {2}.', stalls, dw, unit]+ }}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] }@@ -428,21 +457,25 @@ export function nextPrescription(S, cfg, routine) {const dbl = policy === 'greyskull' && last.goal > 0 && last.amrap >= last.goal * 2const step = dbl ? inc * 2 : increturn {- policy, kind: 'up', weight: addStep(w, step, inc),+ policy, kind: 'up', weight: harder(w, step),why: dbl? ['Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.', last.amrap, step, unit]- : ['Every rep last time — {0} {1} more.', step, unit]+ : assisted+ ? ['Every rep last time — {0} {1} less help.', step, unit]+ : ['Every rep last time — {0} {1} more.', step, unit]}}if (stalls >= deloadAt) {const selected = epleyDeload()if (selected) return selected- const dw = deloadTo(w, inc)+ const dw = easier(w)return {policy, kind: 'deload', weight: dw,- why: stalls > 1- ? ['Missed reps {0} sessions running — reset to {1} {2} and work back up.', stalls, dw, unit]- : ['Missed reps — reset to {0} {1} and work back up.', dw, unit]+ why: assisted+ ? ['Missed reps — {0} {1} of help while you build back up.', dw, unit]+ : stalls > 1+ ? ['Missed reps {0} sessions running — reset to {1} {2} and work back up.', stalls, dw, unit]+ : ['Missed reps — reset to {0} {1} and work back up.', dw, unit]}}return { policy, kind: 'hold', weight: w, why: ['Missed reps last time — same weight again ({0} of {1} to go).', deloadAt - stalls, deloadAt] }diff --git a/frontend/src/lib/progression.test.js b/frontend/src/lib/progression.test.jsindex 8c7bdf501..cb458eb76 100644--- a/frontend/src/lib/progression.test.js+++ b/frontend/src/lib/progression.test.js@@ -5,9 +5,12 @@ import {deloadFactorOf, DELOAD_FACTOR, POLICIES_FOR, DELOAD_AFTER, MAX_BW_SETS} from './progression.js'import { entryExcluded } from './history.js'-import { EXDB } from './exercises.js'+import { EXDB, isAssisted } from './exercises.js'-const LIFT = EXDB.find(e => e.bp !== 'cardio' && !['upper legs', 'lower legs', 'back', 'hips', 'glutes'].includes(e.bp) && !['body weight', 'band', 'resistance band'].includes(e.eq)).id+// A plainly loaded lift: more weight is harder. The first match used to be `assisted chest dip`,+// whose stack takes weight off you and which therefore progresses downwards (issue #232) — these+// tests are about the ordinary direction, so the assistance machines are excluded by name here.+const LIFT = EXDB.find(e => e.bp !== 'cardio' && !['upper legs', 'lower legs', 'back', 'hips', 'glutes'].includes(e.bp) && !['body weight', 'band', 'resistance band'].includes(e.eq) && !isAssisted(e.id)).idconst HEAVY = EXDB.find(e => e.bp === 'upper legs').idconst CARDIO = EXDB.find(e => e.bp === 'cardio').iddiff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex 499a04650..f4923f122 100644--- a/frontend/src/lib/pt-br-locale.test.js+++ b/frontend/src/lib/pt-br-locale.test.js@@ -28,10 +28,10 @@ describe('Brazilian Portuguese locale', () => {const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(645)- expect(inherited).toHaveLength(649)+ expect(inherited).toHaveLength(653)// If this fails, review the changed keys and wording before accepting a new hash. From// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('eb0d354b97143ca3a65813bf9671560151feaf8e77abaf779ad2d1a8daf7969f')+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('d71601df55e68431de99090a6c9c4766eaaa189baf92e0e696f31d2fd2739a88')})test('does not leak European Portuguese UI terms', () => {diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex 3213687bd..668d6ff41 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -648,6 +648,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Gleiches Gewicht — diesmal {0} Wiederholungen anpeilen.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'Letzter Satz mit {0} Wiederholungen — doppelte Vorgabe, also ein doppelter Sprung von {1} {2}.','Every rep last time — {0} {1} more.': 'Letztes Mal jede Wiederholung — {0} {1} mehr.',+ 'Every rep last time — {0} {1} less help.': 'Letztes Mal jede Wiederholung — {0} {1} weniger Hilfe.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Oberes Ende des Wiederholungsbereichs in jedem Satz — {0} {1} weniger Hilfe, zurück auf {2} Wiederholungen.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Wiederholungen verfehlt — {0} {1} Hilfe, bis du dich wieder herangearbeitet hast.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '{0} Einheiten festgefahren — zurück auf {1} {2} Hilfe und neu aufbauen.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': '{0} Einheiten in Folge Wiederholungen verfehlt — zurück auf {1} {2} und wieder hocharbeiten.','Missed reps — reset to {0} {1} and work back up.': 'Wiederholungen verfehlt — zurück auf {0} {1} und wieder hocharbeiten.','Missed reps last time — same weight again ({0} of {1} to go).': 'Letztes Mal Wiederholungen verfehlt — dasselbe Gewicht noch einmal (noch {0} von {1}).',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex b889f7ef2..079e55936 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Mismo peso: esta vez apunta a {0} repeticiones.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'La última serie llegó a {0} repeticiones: el doble del objetivo, así que sube el doble, {1} {2}.','Every rep last time — {0} {1} more.': 'La última vez, todas las repeticiones: {0} {1} más.',+ 'Every rep last time — {0} {1} less help.': 'Todas las repeticiones la última vez — {0} {1} menos de ayuda.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Tope del rango de repeticiones en cada serie — {0} {1} menos de ayuda, vuelve a {2} repeticiones.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Repeticiones falladas — {0} {1} de ayuda mientras vuelves a subir.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '{0} sesiones estancado — vuelve a {1} {2} de ayuda y sube otra vez.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': '{0} sesiones seguidas fallando repeticiones: vuelve a {1} {2} y sube de nuevo.','Missed reps — reset to {0} {1} and work back up.': 'Fallaste repeticiones: vuelve a {0} {1} y sube de nuevo.','Missed reps last time — same weight again ({0} of {1} to go).': 'Fallaste repeticiones la última vez: el mismo peso otra vez (quedan {0} de {1}).',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 671524d30..fd5807d6c 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Même poids — vise {0} répétitions cette fois.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'Dernière série à {0} répétitions — le double de l’objectif, donc un saut double de {1} {2}.','Every rep last time — {0} {1} more.': 'Toutes les répétitions la dernière fois — {0} {1} de plus.',+ 'Every rep last time — {0} {1} less help.': 'Toutes les répétitions la dernière fois — {0} {1} d’aide en moins.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Haut de la fourchette de répétitions à chaque série — {0} {1} d’aide en moins, retour à {2} répétitions.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Répétitions manquées — {0} {1} d’aide le temps de remonter.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '{0} séances au point mort — retour à {1} {2} d’aide et on remonte.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': 'Répétitions manquées {0} séances de suite — retour à {1} {2} et on remonte.','Missed reps — reset to {0} {1} and work back up.': 'Répétitions manquées — retour à {0} {1} et on remonte.','Missed reps last time — same weight again ({0} of {1} to go).': 'Répétitions manquées la dernière fois — même poids à nouveau ({0} sur {1} restants).',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex f0b44b464..481881091 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': 'वही वज़न — इस बार {0} रेप्स का लक्ष्य रखें।','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'आख़िरी सेट में {0} रेप्स — लक्ष्य से दोगुने, इसलिए {1} {2} की दोगुनी छलांग।','Every rep last time — {0} {1} more.': 'पिछली बार सारे रेप्स — {0} {1} ज़्यादा।',+ 'Every rep last time — {0} {1} less help.': 'पिछली बार हर दोहराव — {0} {1} कम सहारा।',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'हर सेट में दोहराव सीमा के शीर्ष पर — {0} {1} कम सहारा, वापस {2} दोहराव पर।',+ 'Missed reps — {0} {1} of help while you build back up.': 'दोहराव छूटे — जब तक दोबारा बनाओ तब तक {0} {1} सहारा।',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '{0} सत्र से रुका हुआ — वापस {1} {2} सहारे पर और फिर से बढ़ाओ।','Missed reps {0} sessions running — reset to {1} {2} and work back up.': 'लगातार {0} सेशन रेप्स चूके — {1} {2} पर लौटें और फिर से बढ़ाएँ।','Missed reps — reset to {0} {1} and work back up.': 'रेप्स चूके — {0} {1} पर लौटें और फिर से बढ़ाएँ।','Missed reps last time — same weight again ({0} of {1} to go).': 'पिछली बार रेप्स चूके — वही वज़न दोबारा ({1} में से {0} बाकी)।',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex 0aefade3d..e60932993 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -604,6 +604,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Ugyanaz a súly — most {0} ismétlést célozz meg.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'Az utolsó sorozat {0} ismétlést ért el — kétszerese a célnak, ezért dupla ugrás: {1} {2}.','Every rep last time — {0} {1} more.': 'Legutóbb minden ismétlés meglett — {0} {1} plusz.',+ 'Every rep last time — {0} {1} less help.': 'Múltkor minden ismétlés megvolt — {0} {1} kevesebb segítség.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Az ismétléstartomány teteje minden sorozatban — {0} {1} kevesebb segítség, vissza {2} ismétlésre.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Kimaradt ismétlések — {0} {1} segítség, amíg visszaépíted.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '{0} edzés óta megrekedt — vissza {1} {2} segítségre, és építsd fel újra.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': '{0} edzés óta hiányoznak ismétlések — vissza {1} {2}, és építsd fel újra.','Missed reps — reset to {0} {1} and work back up.': 'Hiányoztak ismétlések — vissza {0} {1}, és építsd fel újra.','Missed reps last time — same weight again ({0} of {1} to go).': 'Legutóbb hiányoztak ismétlések — ugyanaz a súly megint (még {0} van hátra {1}-ból).',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex d4f3d57ca..33aa36acd 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Stesso peso: questa volta punta a {0} ripetizioni.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'Ultima serie a {0} ripetizioni: il doppio dell’obiettivo, quindi salto doppio di {1} {2}.','Every rep last time — {0} {1} more.': 'L’ultima volta tutte le ripetizioni: {0} {1} in più.',+ 'Every rep last time — {0} {1} less help.': 'Tutte le ripetizioni l’ultima volta — {0} {1} di aiuto in meno.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Cima dell’intervallo di ripetizioni in ogni serie — {0} {1} di aiuto in meno, torna a {2} ripetizioni.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Ripetizioni mancate — {0} {1} di aiuto mentre risali.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': 'Fermo da {0} sessioni — torna a {1} {2} di aiuto e risali.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': 'Ripetizioni mancate per {0} sessioni di fila: torna a {1} {2} e risali.','Missed reps — reset to {0} {1} and work back up.': 'Ripetizioni mancate: torna a {0} {1} e risali.','Missed reps last time — same weight again ({0} of {1} to go).': 'Ripetizioni mancate l’ultima volta: stesso peso ancora ({0} di {1} rimasti).',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex a2af378c4..cee3b3354 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': '같은 무게 — 이번엔 {0}회를 노려보세요.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': '마지막 세트 {0}회 — 목표의 두 배라 {1} {2}만큼 두 배로 올립니다.','Every rep last time — {0} {1} more.': '지난번 전 세트 완수 — {0} {1} 증가.',+ 'Every rep last time — {0} {1} less help.': '지난번에 모든 반복 성공 — 보조 {0} {1} 줄이기.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': '모든 세트에서 반복 범위 상단 — 보조 {0} {1} 줄이고 {2}회로 돌아가기.',+ 'Missed reps — {0} {1} of help while you build back up.': '반복 실패 — 다시 올라올 때까지 보조 {0} {1}.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '{0}회 정체 — 보조 {1} {2}로 돌아가 다시 쌓기.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': '{0}회 연속으로 목표 횟수 미달 — {1} {2}로 되돌리고 다시 올라가세요.','Missed reps — reset to {0} {1} and work back up.': '목표 횟수 미달 — {0} {1}로 되돌리고 다시 올라가세요.','Missed reps last time — same weight again ({0} of {1} to go).': '지난번 목표 횟수 미달 — 같은 무게로 한 번 더 ({1}회 중 {0}회 남음).',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 4784af8ba..7fb541cdd 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Ten sam ciężar — tym razem celuj w {0} powtórzeń.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'Ostatnia seria to {0} powtórzeń — dwukrotność celu, więc podwójny skok o {1} {2}.','Every rep last time — {0} {1} more.': 'Ostatnio wszystkie powtórzenia — {0} {1} więcej.',+ 'Every rep last time — {0} {1} less help.': 'Ostatnio każde powtórzenie — {0} {1} mniej pomocy.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Górny zakres powtórzeń w każdej serii — {0} {1} mniej pomocy, wróć do {2} powtórzeń.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Brak powtórzeń — {0} {1} pomocy, aż wrócisz do formy.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': 'Zastój od {0} sesji — wróć do {1} {2} pomocy i buduj od nowa.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': 'Nieudane powtórzenia w {0} sesjach z rzędu — wróć do {1} {2} i buduj od nowa.','Missed reps — reset to {0} {1} and work back up.': 'Nieudane powtórzenia — wróć do {0} {1} i buduj od nowa.','Missed reps last time — same weight again ({0} of {1} to go).': 'Ostatnio nieudane powtórzenia — ten sam ciężar jeszcze raz (zostało {0} z {1}).',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex b0c515ed8..3976a4c53 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Mesmo peso — desta vez aponta a {0} repetições.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'A última série chegou a {0} repetições — o dobro do objetivo, por isso um salto duplo de {1} {2}.','Every rep last time — {0} {1} more.': 'Da última vez, todas as repetições — mais {0} {1}.',+ 'Every rep last time — {0} {1} less help.': 'Todas as repetições da última vez — {0} {1} menos de ajuda.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Topo do intervalo de repetições em cada série — {0} {1} menos de ajuda, de volta a {2} repetições.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Repetições falhadas — {0} {1} de ajuda enquanto recuperas.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '{0} sessões estagnado — de volta a {1} {2} de ajuda e sobe outra vez.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': 'Repetições falhadas em {0} sessões seguidas — volta a {1} {2} e sobe outra vez.','Missed reps — reset to {0} {1} and work back up.': 'Falhaste repetições — volta a {0} {1} e sobe outra vez.','Missed reps last time — same weight again ({0} of {1} to go).': 'Falhaste repetições da última vez — o mesmo peso outra vez (faltam {0} de {1}).',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex eaa61ca8a..69c503210 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Тот же вес — в этот раз целься на {0} повторений.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'В последнем подходе {0} повторений — вдвое больше цели, поэтому двойной шаг {1} {2}.','Every rep last time — {0} {1} more.': 'В прошлый раз все повторения — плюс {0} {1}.',+ 'Every rep last time — {0} {1} less help.': 'В прошлый раз все повторения — помощи меньше на {0} {1}.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Верх диапазона повторений в каждом подходе — помощи меньше на {0} {1}, снова {2} повторений.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Повторения не добраны — {0} {1} помощи, пока восстанавливаешься.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': 'Застой {0} тренировок — назад к {1} {2} помощи и набирать заново.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': 'Повторения не даются {0} тренировки подряд — вернись к {1} {2} и наращивай снова.','Missed reps — reset to {0} {1} and work back up.': 'Повторения не дались — вернись к {0} {1} и наращивай снова.','Missed reps last time — same weight again ({0} of {1} to go).': 'В прошлый раз повторения не дались — тот же вес ещё раз (осталось {0} из {1}).',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 91518ec49..5b931b033 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -604,6 +604,10 @@ export default {'Same weight — aim for {0} reps this time.': 'น้ำหนักเดิม — ตั้งเป้าที่ {0} ครั้งในรอบนี้','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'เซ็ตสุดท้ายทำได้ {0} ครั้ง — เกินเป้าสองเท่า จึงเพิ่มน้ำหนักแบบก้าวกระโดด {1} {2}','Every rep last time — {0} {1} more.': 'ครั้งก่อนทำครบทุกครั้ง — เพิ่มอีก {0} {1}',+ 'Every rep last time — {0} {1} less help.': 'ครั้งก่อนครบทุกครั้ง — ลดตัวช่วย {0} {1}',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'ถึงเพดานช่วงจำนวนครั้งทุกเซ็ต — ลดตัวช่วย {0} {1} แล้วกลับไปที่ {2} ครั้ง',+ 'Missed reps — {0} {1} of help while you build back up.': 'ทำครบไม่ได้ — ใช้ตัวช่วย {0} {1} ระหว่างไต่กลับขึ้นมา',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': 'ตัน {0} ครั้ง — กลับไปใช้ตัวช่วย {1} {2} แล้วไต่ใหม่','Missed reps {0} sessions running — reset to {1} {2} and work back up.': 'พลาดจำนวนครั้งติดต่อกัน {0} ครั้ง — รีเซ็ตกลับไปที่ {1} {2} แล้วค่อยไต่ขึ้นใหม่','Missed reps — reset to {0} {1} and work back up.': 'พลาดจำนวนครั้ง — รีเซ็ตกลับไปที่ {0} {1} แล้วค่อยไต่ขึ้นใหม่','Missed reps last time — same weight again ({0} of {1} to go).': 'ครั้งก่อนพลาดจำนวนครั้ง — น้ำหนักเดิมอีกครั้ง (เหลืออีก {0} จาก {1})',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 4cbfe3b65..eac019caa 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': 'Aynı ağırlık — bu sefer {0} tekrarı hedefle.','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': 'Son set {0} tekrar — hedefin iki katı, bu yüzden {1} {2} çift artış.','Every rep last time — {0} {1} more.': 'Geçen sefer bütün tekrarlar tamam — {0} {1} daha.',+ 'Every rep last time — {0} {1} less help.': 'Geçen sefer her tekrar tamam — {0} {1} daha az destek.',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': 'Her sette tekrar aralığının üstü — {0} {1} daha az destek, {2} tekrara dön.',+ 'Missed reps — {0} {1} of help while you build back up.': 'Tekrarlar eksik — toparlanana kadar {0} {1} destek.',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '{0} antrenmandır takılı — {1} {2} desteğe dön ve yeniden çık.','Missed reps {0} sessions running — reset to {1} {2} and work back up.': 'Üst üste {0} seans tekrarlar eksik — {1} {2} ağırlığa dön ve yeniden çık.','Missed reps — reset to {0} {1} and work back up.': 'Tekrarlar eksik kaldı — {0} {1} ağırlığa dön ve yeniden çık.','Missed reps last time — same weight again ({0} of {1} to go).': 'Geçen sefer tekrarlar eksikti — aynı ağırlık bir kez daha ({1} denemeden {0} kaldı).',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex fa6576554..cafc3f6bd 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -629,6 +629,10 @@ export default {'Same weight — aim for {0} reps this time.': '同样的重量——这次目标 {0} 次。','Last set hit {0} reps — twice the target, so take a double jump of {1} {2}.': '最后一组做了 {0} 次——是目标的两倍,因此加倍上调 {1} {2}。','Every rep last time — {0} {1} more.': '上次全部完成——加 {0} {1}。',+ 'Every rep last time — {0} {1} less help.': '上次每组都完成 — 辅助减少 {0} {1}。',+ 'Top of the rep range in every set — {0} {1} less help, back to {2} reps.': '每组都达到次数上限 — 辅助减少 {0} {1},回到 {2} 次。',+ 'Missed reps — {0} {1} of help while you build back up.': '次数未达标 — 辅助 {0} {1},慢慢练回来。',+ 'Stalled {0} sessions — back to {1} {2} of help and build up again.': '已停滞 {0} 次 — 回到 {1} {2} 辅助,重新往上加。','Missed reps {0} sessions running — reset to {1} {2} and work back up.': '连续 {0} 次未完成次数——回到 {1} {2} 重新往上做。','Missed reps — reset to {0} {1} and work back up.': '次数未完成——回到 {0} {1} 重新往上做。','Missed reps last time — same weight again ({0} of {1} to go).': '上次次数未完成——再用同样的重量(还剩 {0}/{1} 次)。',diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 128bf1c38..284f0cf1e 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -1,7 +1,7 @@import { useEffect, useMemo, useRef, useState } from 'react'import { useStore } from './store/useStore.js'import { useUI } from './store/useUI.js'-import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf, smOf, searchExercises, exOr } from './lib/exercises.js'+import { EXDB, EXIDX, BODYPARTS, isCardio, isBodyweightEq, allExercises, equipmentOf, smOf, searchExercises, exOr, isAssisted, betterWeight, beatsWeight } from './lib/exercises.js'import { activeProfile, exAvailable, ALL_EQUIPMENT, newProfile } from './lib/equipment.js'import { fmtDate, fmtNum, capWords, fmtVol, fmtDur, durPart, todayISO, isoOf, uid, exCount, routineCount, DAYN, DAYS, weekOrder, weekStartOf, weekDayOffset, MONTHS_LONG, ACCENTS } from './lib/format.js'import { lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, effectiveRoutineIds, workoutVolume, setsDone, setsDoneActive, setUnitsTotal, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg, modeOf, effortOf, EFFORT, capEffort, stepEffort, isBw, isPerSide, sideReps, workSetsDone, applyIntensifierPlan, MAX_PLANNED_WARMUPS, NOTE_MAX } from './lib/history.js'@@ -1942,9 +1942,13 @@ function TopWeight({ entryIdx, close }) {// to sit after every one of them.const entry = A ? A.entries[entryIdx] : nullconst ex = entry && EXIDX[entry.id]- const maxSet = entry ? Math.max(0, ...entry.sets.filter(s => s.done && !isWarmupRow(s)).map(s => s.w || 0)) : 0- const prevBest = entry ? Math.max((st.exWeights[entry.id] || {}).w || 0, bestWeightFor(st, entry.id)) : 0- const [v, setV] = useState(entry ? (Math.max(maxSet, prevBest) || entry.target.weight || 0) : 0)+ // "Best" runs the other way on an assistance machine: the lightest setting is the record, and+ // a 0 means nothing logged rather than a new low (issue #232).+ const fold = (a, b) => (a > 0 && b > 0 ? betterWeight(entry.id, a, b) : Math.max(a, b))+ const doneW = entry ? entry.sets.filter(s => s.done && !isWarmupRow(s)).map(s => s.w || 0).filter(w => w > 0) : []+ const maxSet = entry && doneW.length ? doneW.reduce((a, b) => betterWeight(entry.id, a, b)) : 0+ const prevBest = entry ? fold((st.exWeights[entry.id] || {}).w || 0, bestWeightFor(st, entry.id)) : 0+ const [v, setV] = useState(entry ? (fold(maxSet, prevBest) || entry.target.weight || 0) : 0)useEffect(() => { if (!entry) close() }, [!entry])const units = supersetUnits(A ? A.entries : [])@@ -1960,7 +1964,7 @@ function TopWeight({ entryIdx, close }) {update(s => {s.active.entries[entryIdx].topW = nconst cur = s.exWeights[entry.id]- s.exWeights[entry.id] = { w: Math.max(n, cur ? cur.w : 0), d: todayISO() }+ s.exWeights[entry.id] = { w: cur && cur.w > 0 && n > 0 ? betterWeight(entry.id, n, cur.w) : Math.max(n, cur ? cur.w : 0), d: todayISO() }})close()if (advance && unitDone) {@@ -2173,8 +2177,9 @@ function doFinishWorkout() {// A workout logged into the past cannot claim records against the history that came after// it, so a backfilled session reports none and leaves the confirmed weights alone.if (!past) A.entries.forEach(e => {- const mx = Math.max(0, ...e.sets.filter(s => s.done && !isWarmupRow(s)).map(s => s.w))- if (mx > 0 && mx > bestWeightFor(st, e.id)) prs.push(e.id)+ const loads = e.sets.filter(s => s.done && !isWarmupRow(s)).map(s => s.w).filter(w => w > 0)+ const mx = loads.length ? loads.reduce((a, b) => betterWeight(e.id, a, b)) : 0+ if (beatsWeight(e.id, mx, bestWeightFor(st, e.id))) prs.push(e.id)// A heavier estimate without a heavier top set is its own kind of progress —// same weight for more reps. Reported separately so it can't be read as a load PR.const rec = is1RMRecord(st, e.id, e)@@ -2192,7 +2197,7 @@ function doFinishWorkout() {} else {w.entries.forEach(e => {const mx = bestWeightForEntry(e)- if (mx > 0) { const cur = s.exWeights[e.id]; if (!cur || mx > cur.w) s.exWeights[e.id] = { w: mx, d: w.d } }+ if (mx > 0 && beatsWeight(e.id, mx, (s.exWeights[e.id] || {}).w || 0)) s.exWeights[e.id] = { w: mx, d: w.d }})s.workouts.push(w)}diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex ae0f9a7d8..91aaf3dc8 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 { workoutControls } from '../lib/workout-controls.js'import { useUI } from '../store/useUI.js'-import { exOr } from '../lib/exercises.js'+import { exOr, betterWeight } from '../lib/exercises.js'import { usesBar, barWeightFor, plateSplit } from '../lib/bar.js'import { effectiveRoutines, effectiveRoutineIds, lastEntryFor, bestWeightFor, bestWeightForEntry, buildSets, freestyleConfig, defaultConfig, setsDoneActive, setUnitsTotal, supersetUnits, unitOf, setLabel, modeOf, isBw, isPerSide, repStep, EFFORT, effortOf, stepEffort, capEffort, cascadeWeight, insertWarmupRow, removeRowAt, pairAdjacent, unpairSuperset, cleanupSg, applyIntensifierPlan, pinnedNoteFor, exNoteFor } from '../lib/history.js'import { fmtNum, capWords, fmtDate, todayISO, exCount, DAYN } from '../lib/format.js'@@ -134,7 +134,12 @@ function ExerciseBlock({ entryIdx, compact, dense, onToggle, onToggleSide, onFie// telling you what to do in it is behind you, and the block is already long.const pinnedNote = entry.sets.some(s => !s.done) ? pinnedNoteFor(S, entry.id) : null// The number is the heaviest logged set, or the working weight you kept.- const best = cardio ? 0 : Math.max(bestWeightFor(S, entry.id), (S.exWeights[entry.id] || {}).w || 0)+ // On an assistance machine the best is the least help, and a 0 on either side means "nothing+ // logged" rather than a record (issue #232).+ const bestHist = bestWeightFor(S, entry.id)+ const bestKept = (S.exWeights[entry.id] || {}).w || 0+ const best = cardio ? 0+ : bestHist > 0 && bestKept > 0 ? betterWeight(entry.id, bestHist, bestKept) : Math.max(bestHist, bestKept)// 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