astashov / liftosaur

Weightlifting tracker app for coders
https://www.liftosaur.com
GNU Affero General Public License v3.0
228 stars 31 forks source link

[Bug] Custom Progress Block Not Copied from Template Exercise #90

Closed jm96441n closed 5 months ago

jm96441n commented 5 months ago

Like the title, when I create a template exercise the custom progress that I defined for it isn't used by exercises that use that template, attached below is a setup that replicates the issue. When you use this setup in the program playground or in the program itself none of the exercises that use ..base_4_15:Lateral Box Jump as the template use any progression that the template defines:

# Week 1
## Push
Overhead Press / ...base_4_15:Lateral Box Jump
Chest Dip / ...base_4_15:Lateral Box Jump
Triceps Pushdown, Cable / ...base_4_15:Lateral Box Jump
Lateral Raise, Dumbbell / 2x15, 1x15+ / ...base_4_15:Lateral Box Jump

## Day 2

## Day 3

## Day 4

## Day 5
base_4_15:Lateral Box Jump / 3x15, 1x15+ / 57.5% / used: none / progress: custom(week: 1) {~
  var.nextReps = 0
  var.nextIntensity = 0

 if (completedReps[numberOfSets] > reps[numberOfSets] + 5) {
    rm1 = rm1 * 1.03
  } else if (completedReps[numberOfSets] > reps[numberOfSets] + 4) {
    rm1 = rm1 * 1.02
  } else if (completedReps[numberOfSets] == reps[numberOfSets] + 3) {
    rm1 = rm1 * 1.015
  } else if (completedReps[numberOfSets] == reps[numberOfSets] + 2) {
    rm1 = rm1 * 1.01
  } else if (completedReps[numberOfSets] == reps[numberOfSets] + 1) {
    rm1 = rm1 * 1.005
  } else if (completedReps[numberOfSets] == reps[numberOfSets] - 2) {
    rm1 = (rm1 - (rm1 * 0.02))
  } else if (completedReps[numberOfSets] <= reps[numberOfSets] - 1) {
    rm1 = (rm1 - (rm1 * 0.05))
  }

state.week = state.week + 1
if (state.week > 6) {
  state.week = 1
}
if (state.week == 1) { var.nextIntensity = 95} 
if (state.week == 2) { var.nextIntensity = 60 }
if (state.week == 3) { var.nextIntensity = 62.5 }
if (state.week == 4) { var.nextIntensity = 65 }
if (state.week == 5) { var.nextIntensity = 67.5 }
if (state.week == 6) { var.nextIntensity = 70 }

if (var.nextIntensity > 95) { var.nextReps = 1 }
else if (var.nextIntensity > 87.5) { var.nextReps = 2 }
else if (var.nextIntensity > 85) { var.nextReps = 3 }
else if (var.nextIntensity > 82.5) { var.nextReps = 4 }
else if (var.nextIntensity > 80) { var.nextReps = 5 }
else if (var.nextIntensity > 77.5) { var.nextReps = 6 }
else if (var.nextIntensity > 75) { var.nextReps = 7 }
else if (var.nextIntensity > 72.5) { var.nextReps = 8 }
else if (var.nextIntensity > 70) { var.nextReps = 9 }
else if (var.nextIntensity > 67.5) { var.nextReps = 10 }
else if (var.nextIntensity > 65) { var.nextReps = 11 }
else if (var.nextIntensity > 62.5) { var.nextReps = 12 }
else if (var.nextIntensity > 60) { var.nextReps = 13 }
else if (var.nextIntensity > 57.5) { var.nextReps = 14 }
else if (var.nextIntensity > 55) { var.nextReps = 15 }
else { var.nextReps = 5 }

weights = rm1 * (var.nextIntensity / 100)
reps = var.nextReps
~}
jm96441n commented 5 months ago

Closing because I missed it in the docs, sorry for the noise (the app is awesome!)