Closed Seerden closed 2 years ago
Intermediate partial to-do:
activeWorkoutState
useWorkoutState
hook that manages
Current thoughts on state for sessions:
workout
comes from query cache
suggested weight
comes from backend in separate request. Use the form {exercise_ID, weight, reps, sets}, using exercise.reps and exercise.sets for now. Once we implement support for e g. 5/3/1, we won't have to change this data shape.
use an atom to store session entries. Use a minimal keyless (hashmap-like) object like
'2': { '60kg': [{ reps: 12, timestamp: 274648383629 }] }
Using a hash map like this makes accessing and updating values in state a lot more readable.
don't use timestamps for reps completed. Just assume the highest weight is the working weight for now when submitting, and mark everything else as a warmup set. Another option is to set a timestamp the first time a value is added but not when it's updated.
idea: to track warmup sets, use two buttons: add warmup set, add working set
include an isActive
field in session state, this determines the ActiveExercise we display.
implemented happy path for workout exercise suggestions: use starting weight/deload/progressively overload depending on how the user fared on the exercise the last time they performed it.
I'm doubting the way I've set up the sessionEntries
state client-side. It works, but I feel like there should be a cleaner way to go about it.
suggestWorkout
:
set_index
property or something similarly named in workout_session_entries
, this ensures we always have a deterministic way to find the final set performedSessionLog
I'm happy with this right now as a first implementation. Been at this for a while already, so I'm creating some spin-off issues to work out some optimizations tweaks, and also tests.
See #5.
Changes
Miscellaneous:
useQueryWorkoutsByUser()
onSuccess
whatwg-fetch
so that render tests don't break in the jsdom testing environmentAnimatePresence