Skip to content

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.

Follow-up to !140: ATG's standards are read at their own reps, not as a 1RM

Duarte Santos6289848300cc
diff --git a/frontend/src/lib/structuralBalance.js b/frontend/src/lib/structuralBalance.js
index 6ffa3ddbe..5e6849b1d 100644
--- a/frontend/src/lib/structuralBalance.js
+++ b/frontend/src/lib/structuralBalance.js
@@ -158,6 +158,13 @@ export function exerciseIdsFor(S, template, role) {
return override ? [override] : role.exerciseIds
}
+// ATG's figures are a load for a number of reps ("Romanian deadlift: body weight for 12"), not a
+// one-rep max, so the estimate is read back at the role's reps before it is compared — Epley, the
+// formula estimate1RM() estimates with, run the other way, so a set of exactly that many reps
+// comes back as its own load. Held against the 1RM itself, a lifter at 72% of body weight for 12
+// read as balanced on a body-weight-for-12 standard.
+export const loadForReps = (oneRmKg, reps) => (reps > 1 ? oneRmKg / (1 + reps / 30) : oneRmKg)
+
// Actual percentage a role's current reading represents, given its evaluation mode. Returns
// null when it can't be scored yet (anchor has no reading of its own, or bodyweight unknown).
export function ratioFor(role, current, ctx) {
@@ -167,7 +174,7 @@ export function ratioFor(role, current, ctx) {
}
if (role.evaluationMode === EVALUATION_MODES.BODYWEIGHT_RATIO) {
if (!(ctx.bodyweightKg > 0)) return null
- return (current.estKg / ctx.bodyweightKg) * 100
+ return (loadForReps(current.estKg, role.reps) / ctx.bodyweightKg) * 100
}
// rep-count: the best completed-set rep count (resolveCurrentReps), as a percentage of the
// target rep count.
diff --git a/frontend/src/lib/structuralBalance.test.js b/frontend/src/lib/structuralBalance.test.js
index e3c7e0100..7c232f536 100644
--- a/frontend/src/lib/structuralBalance.test.js
+++ b/frontend/src/lib/structuralBalance.test.js
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
-import { computeBalance, classify, ratioFor, resolveCurrent, resolveCurrentReps, targetFor, overrideKey, overrideIdOf, withOverride } from './structuralBalance.js'
+import { computeBalance, classify, ratioFor, resolveCurrent, resolveCurrentReps, targetFor, overrideKey, overrideIdOf, withOverride, loadForReps } from './structuralBalance.js'
import { TEMPLATES, EVALUATION_MODES, BALANCE_STATUSES, BORDERLINE_BAND_PCT } from './structuralBalanceTemplates.js'
const NOW = Date.parse('2026-01-15T00:00:00Z')
@@ -82,7 +82,7 @@ describe('computeBalance — bodyweight-ratio mode (ATG)', () => {
unit: 'kg',
body: 'male',
bodyweight: [{ d: '2026-01-01', w: bwKg }],
- workouts: [workoutAt('0085', NOW, [setDone(rdlW, 1)])],
+ workouts: [workoutAt('0085', NOW, [setDone(rdlW, 12)])], // the standard is a load for 12
})
it('balanced/borderline/weak edges against bodyweight (male target 100%)', () => {
@@ -103,6 +103,27 @@ describe('computeBalance — bodyweight-ratio mode (ATG)', () => {
expect(results.find(r => r.roleId === 'romanianDeadlift').targetPct).toBe(80)
})
+ it('reads the estimate back at the role\'s reps: body weight for 12 is not a body-weight 1RM', () => {
+ // 58 kg for 12 at 80 kg estimates an 81.2 kg 1RM — over body weight, but 72.5% of the
+ // body-weight-for-12 the standard asks for.
+ const rdl = computeBalance(sWithBw(80, 58), template).find(r => r.roleId === 'romanianDeadlift')
+ expect(rdl.current.estKg).toBeCloseTo(81.2)
+ expect(rdl.actualPct).toBeCloseTo(72.5, 1)
+ expect(rdl.status).toBe(BALANCE_STATUSES.WEAK)
+ // A heavy single is read forward the same way: 100 kg once is about 71 kg for 12.
+ const single = { ...sWithBw(80, 0), workouts: [workoutAt('0085', NOW, [setDone(100, 1)])] }
+ expect(computeBalance(single, template).find(r => r.roleId === 'romanianDeadlift').actualPct).toBeCloseTo(89.3, 1)
+ })
+
+ it('every ATG load standard names its reps, and a set of exactly that many comes back as itself', () => {
+ for (const role of template.roles.filter(r => r.evaluationMode === EVALUATION_MODES.BODYWEIGHT_RATIO)) {
+ expect(role.reps, role.id).toBeGreaterThan(1)
+ expect(role.label).toContain(`${role.reps} reps`)
+ }
+ expect(loadForReps(112, 12)).toBeCloseTo(80)
+ expect(loadForReps(90, 1)).toBe(90)
+ })
+
it('no-data when bodyweight was never logged', () => {
const S = { unit: 'kg', workouts: [workoutAt('0085', NOW, [setDone(80, 1)])], bodyweight: [] }
const results = computeBalance(S, template)
diff --git a/frontend/src/lib/structuralBalanceTemplates.js b/frontend/src/lib/structuralBalanceTemplates.js
index 6a3208257..bdcc44e93 100644
--- a/frontend/src/lib/structuralBalanceTemplates.js
+++ b/frontend/src/lib/structuralBalanceTemplates.js
@@ -34,6 +34,9 @@ export const BORDERLINE_BAND_PCT = 5
// targetPct load-ratio (% of anchor's 1RM) / bodyweight-ratio (% of bodyweight)
// targetPctFemale bodyweight-ratio only, when the source gives a distinct female figure for
// the same exercise — picked when S.body === 'female'
+// reps bodyweight-ratio only: how many reps the source's load is for ("body
+// weight for 12"). The estimated 1RM is read back at that many reps before
+// it is compared (structuralBalance.js loadForReps)
// repsTarget rep-count only: target rep count at bodyweight
// repsTargetFemale rep-count only, when the source gives a distinct female rep target
@@ -164,6 +167,7 @@ export const TEMPLATES = {
exerciseIds: ['0085'],
targetPct: 100,
targetPctFemale: 80,
+ reps: 12,
},
{
id: 'goodMorning',
@@ -172,6 +176,7 @@ export const TEMPLATES = {
exerciseIds: ['0090'],
targetPct: 66,
targetPctFemale: 40,
+ reps: 10,
},
{
id: 'stepUp',
@@ -180,6 +185,7 @@ export const TEMPLATES = {
exerciseIds: ['0114', '0431'],
targetPct: 50,
targetPctFemale: 40,
+ reps: 15,
},
{
id: 'nordicCurl',
@@ -210,13 +216,12 @@ export const TEMPLATES = {
},
{
id: 'inclineDbPress',
- // MVP simplification: source specifies 40%/20% bodyweight AND x8 reps; only the load
- // percentage is scored (see plan §5 fidelity trade-off).
label: 'Incline DB press (each hand, 8 reps)',
evaluationMode: EVALUATION_MODES.BODYWEIGHT_RATIO,
exerciseIds: ['0314', '3545'],
targetPct: 40,
targetPctFemale: 20,
+ reps: 8,
},
{
id: 'dbShoulderPress',
@@ -225,6 +230,7 @@ export const TEMPLATES = {
exerciseIds: ['0405', '0404', '0361', '0360'],
targetPct: 33,
targetPctFemale: 15,
+ reps: 8,
},
],
},