Skip to content

Commit

Permalink
fix: avoid rep adjustment if lastSetToFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyAsh5114 committed Oct 24, 2024
1 parent 44c73f3 commit 8f154a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/utils/workoutUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,15 +490,15 @@ export function progressiveOverloadMagic(
set.RIR = currentCycleRIR;

// Last set to failure
if (idx === ex.sets.length - 1)
if (typeof ex.lastSetToFailure === 'boolean') set.RIR = ex.lastSetToFailure ? 0 : set.RIR;
else if (mesocycle.lastSetToFailure === true) set.RIR = 0;
const lastSetToFailure = ex.lastSetToFailure ?? mesocycle.lastSetToFailure;
if (idx === ex.sets.length - 1 && lastSetToFailure) set.RIR = 0;

// Adjust reps when RIR changed
const RIRDifference = set.RIR - oldRIR;
if (set.reps === undefined) return;

if (RIRDifference > 0 && !(ex.forceRIRMatching ?? mesocycle.forceRIRMatching)) return;
if (set.reps - RIRDifference < ex.repRangeStart) {
if (set.reps - RIRDifference < ex.repRangeStart && !lastSetToFailure) {
const maxRIR = Math.max(ex.repRangeStart - set.reps, 0);
set.RIR = maxRIR;
set.reps -= maxRIR - oldRIR;
Expand Down

0 comments on commit 8f154a0

Please sign in to comment.