feat: add Epley-based automatic deload targets
This commit is contained in:
1 parent
5c2005e81f
commit
d6ae10820d
9 files changed
+382
-23
No files matched your search
@@ -1063,6 +1063,8 @@ function ProgressionFields({ ex, mode, c, setC, routine, unit, perSide }) {
|
||||
const invalid = !progressionStepIsValid(inc, active)
|
||||
const stride = mode === 'reps' && perSide ? 2 : 1
|
||||
const range = active === 'double' ? normalizeRepRange(c.reps, c.repsMin, stride) : null
|
||||
const epleyEligible = mode === 'reps' && !isBw({ ...c, id: ex.id }) && (active === 'linear' || active === 'double')
|
||||
const deloadPercent = Math.round((Number(c.deloadFactor) > 0 ? Number(c.deloadFactor) : 0.9) * 100)
|
||||
const setRule = v => setC(x => {
|
||||
const next = { ...x, prog: v || undefined }
|
||||
return policyFor({ ...next, id: ex.id }, routine, mode) === 'double'
|
||||
@@ -1089,6 +1091,8 @@ function ProgressionFields({ ex, mode, c, setC, routine, unit, perSide }) {
|
||||
<Stepper label={t('Reps up to')} value={c.reps ?? range.reps} step={stride} decimal={false}
|
||||
onChange={v => setC(x => ({ ...x, reps: v }))} />
|
||||
</>}
|
||||
{epleyEligible && <Stepper label={t('Deload 1RM (%)')} value={deloadPercent} step={5} decimal={false}
|
||||
onChange={v => setC(x => ({ ...x, deloadFactor: Math.max(0.5, Math.min(0.95, Number(v) / 100)) }))} />}
|
||||
</div>}
|
||||
{invalid && <div className="small" role="alert" style={{ color: 'var(--red)', marginTop: -10, marginBottom: 18 }}>
|
||||
{t('Enter a positive step to use this progression rule.')}
|
||||
@@ -1132,6 +1136,12 @@ function ExConfig({ ex, existing, onSave, onDelete, close, routine, initial }) {
|
||||
const prog = {}
|
||||
if (c.prog) prog.prog = c.prog
|
||||
if (c.inc > 0) prog.inc = c.inc
|
||||
// Epley deloading is configurable per occurrence, but the default stays omitted so older
|
||||
// plans retain their compact shape and keep the existing 90% behaviour.
|
||||
if (mode === 'reps' && !bw && (activePolicy === 'linear' || activePolicy === 'double')) {
|
||||
const deloadFactor = Math.max(0.5, Math.min(0.95, Number(c.deloadFactor) || 0.9))
|
||||
if (deloadFactor !== 0.9) prog.deloadFactor = deloadFactor
|
||||
}
|
||||
// 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.
|
||||
// `bodyweight` is true of a hold as much as of a set of reps; `side` is not — it counts
|
||||
|
||||
Reference in new issue
Block a user