astashov / liftosaur

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

[Bug] Editing State of Substituted Exercise Reverts Substitution #82

Closed OpenSauce closed 7 months ago

OpenSauce commented 7 months ago

Hey there, firstly wanted to say great work. I've never really used apps for workouts as they tend to lack cuzomizability but really been loving this app.

I've noticed an issue when modifying thestate of a substituted exercise, specifically if you're substituting one within the program.

Steps to reproduce:

  1. Substitute Exercise
  2. When clicking on edit, it will still have the old exercise name
  3. Modifying weight and clicking done will revert to the previous exercise.

If you click edit the whole exercise it seems to work as intended.

Thanks! Would love dig into this myself and help out if I get some spare time :)

astashov commented 7 months ago

If by weight you mean the weight state variable - this it's kinda expected.

The weight state var is in program exercise, so when you change state var - it changes the program and reapplies the changed program to the current workout. And this way gets back the exercise from a program.

Probably would make sense to keep track of what user changed and avoid changing that when reapplying a program, but I frankly now have limited support for the old-style programs (i.e. non plain-text based).