warm-up sets: excluded from 1RM and progression only (volume semantics kept); tests
This commit is contained in:
1 parent
0109857249
commit
cbb3630423
3 files changed
+21
-5
No files matched your search
@@ -44,7 +44,7 @@ export function estimate1RM(w, r, formula = DEFAULT_FORMULA) {
|
||||
export function bestSetOf(entry, formula = DEFAULT_FORMULA) {
|
||||
let best = null
|
||||
;(entry?.sets || []).forEach(s => {
|
||||
if (!s.done) return
|
||||
if (!s.done || s.warmup) return
|
||||
const est = estimate1RM(s.w, s.r, formula)
|
||||
if (est !== null && (!best || est > best.est)) best = { est, w: Number(s.w), r: Math.round(Number(s.r)) }
|
||||
})
|
||||
|
||||
@@ -146,3 +146,19 @@ describe('is1RMRecord', () => {
|
||||
expect(is1RMRecord(S, 'bench', { id: 'bench', sets: [{ w: 200, r: 5, done: false }] })).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
describe('warm-up sets and 1RM', () => {
|
||||
const ENTRY = { id: 'warm-test', sets: [
|
||||
{ w: 20, r: 8, done: true, warmup: true },
|
||||
{ w: 80, r: 5, done: true },
|
||||
] }
|
||||
|
||||
it('does not let a ticked-off warm-up set set or raise the estimated 1RM', () => {
|
||||
const working = { id: 'warm-test', sets: [{ w: 80, r: 5, done: true }] }
|
||||
expect(bestSetOf(ENTRY)).toEqual(bestSetOf(working))
|
||||
expect(best1RM({ workouts: [{ entries: [ENTRY] }] }, 'warm-test')).toBe(
|
||||
best1RM({ workouts: [{ entries: [working] }] }, 'warm-test'),
|
||||
)
|
||||
})
|
||||
})
|
||||
@@ -110,7 +110,7 @@ export function readSession(entry, fallback) {
|
||||
const held = sets.map(s => (s.done ? (s.sec || 0) : 0))
|
||||
return {
|
||||
mode, goal, held,
|
||||
weight: Math.max(0, ...sets.filter(s => s.done).map(s => s.w || 0)),
|
||||
weight: Math.max(0, ...sets.filter(s => s.done && !s.warmup).map(s => s.w || 0)),
|
||||
best: Math.max(0, ...held),
|
||||
ok: goal > 0 && enough && held.length > 0 && held.every(h => h >= goal)
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export function readSession(entry, fallback) {
|
||||
const reps = sets.map(s => (s.done ? (s.r || 0) : 0))
|
||||
return {
|
||||
mode, goal, reps,
|
||||
weight: Math.max(0, ...sets.filter(s => s.done).map(s => s.w || 0)),
|
||||
weight: Math.max(0, ...sets.filter(s => s.done && !s.warmup).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
|
||||
@@ -132,7 +132,7 @@ export function sessionsFor(S, exId, fallback) {
|
||||
const out = []
|
||||
;(S.workouts || []).forEach(w => {
|
||||
const entry = w.entries.find(e => e.id === exId)
|
||||
if (entry && entry.sets.some(s => s.done)) out.push({ d: w.d, ...readSession(entry, fallback) })
|
||||
if (entry && entry.sets.some(s => s.done && !s.warmup)) out.push({ d: w.d, ...readSession(entry, fallback) })
|
||||
})
|
||||
return out
|
||||
}
|
||||
@@ -250,7 +250,7 @@ export function nextPrescription(S, cfg, routine) {
|
||||
export function applyPrescription(sets, p) {
|
||||
if (!p || p.kind === 'off' || p.kind === 'first') return sets
|
||||
const out = sets.map(s => {
|
||||
if (s.done) return s
|
||||
if (s.done && !s.warmup) return s
|
||||
const o = { ...s }
|
||||
if (p.weight != null) o.w = p.weight
|
||||
if (p.reps != null) o.r = p.reps
|
||||
|
||||
Reference in new issue
Block a user