Have weight and reps auto populate from previous workout. #70

Open
opened 1 year ago by gmillerdesigns · 7 comments
gmillerdesigns commented 1 year ago (Migrated from github.com)
Owner

I'm sure I'm not the only one that would find it helpful if reps and weight from my workout were saved at the end of the a workout and auto populated when I next do that workout.

I'm sure I'm not the only one that would find it helpful if reps and weight from my workout were saved at the end of the a workout and auto populated when I next do that workout.
noahjutz commented 1 year ago (Migrated from github.com)
Owner

I agree, I've been planning to implement that. Thanks for the suggestion.

I agree, I've been planning to implement that. Thanks for the suggestion.

I had started to work on this, but I have one question about "which" previous workout to load. Think of a set up with Routine A and Routine B, both of which have Exercise E (amongst others).

Assume that, with Routine A on one day, you record 5 reps at 50 kg for Exercise E, followed by recording 6 reps at 60 kg in Routine B on another day. The next time you open up Routine A, what should it load for Exercise E? 5 reps at 50 kg, or 6 reps at 60 kg? The former is slightly more complicated, but both of these approaches would benefit from a new table containing the last weight and reps of an exercise (although not necessarily needed). Let me know what you think.

I had started to work on this, but I have one question about "which" previous workout to load. Think of a set up with Routine A and Routine B, both of which have Exercise E (amongst others). Assume that, with Routine A on one day, you record 5 reps at 50 kg for Exercise E, followed by recording 6 reps at 60 kg in Routine B on another day. The next time you open up Routine A, what should it load for Exercise E? 5 reps at 50 kg, or 6 reps at 60 kg? The former is slightly more complicated, but both of these approaches would benefit from a new table containing the last weight and reps of an exercise (although not necessarily needed). Let me know what you think.
Owner

Regarding your first question, I think the value should be inherited from the previous workout of the same routine, but it's debatable. One caveat is that workouts aren't associated with their routines in the current database schema, so there's no way to know which workouts belong to which routine. You could fix this by implementing a relationship between workouts and routines by adding a routineId column to the workout table.

I don't think adding a new table is the right approach, because it would be a redundant data source which can cause bugs. It would be easier to just write a SQL query to get the latest set of the same exercise, something like this:

--exerciseId is passed as argument
SELECT * FROM workout_set_group_table WHERE exerciseId=exerciseId AND (/*is in latest workout*/)

I'm not sure how to figure out the 'is in latest workout' condition yet.

Regarding your first question, I think the value should be inherited from the previous workout of the same routine, but it's debatable. One caveat is that workouts aren't associated with their routines in the current database schema, so there's no way to know which workouts belong to which routine. You could fix this by implementing a relationship between workouts and routines by adding a `routineId` column to the workout table. I don't think adding a new table is the right approach, because it would be a redundant data source which can cause bugs. It would be easier to just write a SQL query to get the latest set of the same exercise, something like this: ``` SQL --exerciseId is passed as argument SELECT * FROM workout_set_group_table WHERE exerciseId=exerciseId AND (/*is in latest workout*/) ``` I'm not sure how to figure out the 'is in latest workout' condition yet.

You could fix this by implementing a relationship between workouts and routines by adding a routineId column to the workout table.

Agreed, that seems reasonable.

I'm not sure how to figure out the 'is in latest workout' condition yet.

I will take a look and come back to you. Thanks!

> You could fix this by implementing a relationship between workouts and routines by adding a routineId column to the workout table. Agreed, that seems reasonable. > I'm not sure how to figure out the 'is in latest workout' condition yet. I will take a look and come back to you. Thanks!

seems like this took a big step back on the new release, i was getting a prompt to update workout values at the end of my workout and those values were there for the next workout. new build is prettier but no longer prompts to update workout.

seems like this took a big step back on the new release, i was getting a prompt to update workout values at the end of my workout and those values were there for the next workout. new build is prettier but no longer prompts to update workout.
Owner

You could fix this by implementing a relationship between workouts and routines by adding a routineId column to the workout table.

Agreed, that seems reasonable.

@rijul I've added a routineId column to workout_table in database version 43 (7f67c17233). Workouts now don't have a name, but are always connected to a routine with a name.

> > You could fix this by implementing a relationship between workouts and routines by adding a routineId column to the workout table. > > Agreed, that seems reasonable. @rijul I've added a `routineId` column to workout_table in database version 43 (7f67c17233). Workouts now don't have a name, but are always connected to a routine with a name.
Owner

@gmillerdesigns a better "workout completed" screen is coming in the next version. The new screen will allow you to return to your workout if you accidentally finished it, and it will let you update the routine like before. Here's what it will look like.

@gmillerdesigns a better "workout completed" screen is coming in the next version. The new screen will allow you to return to your workout if you accidentally finished it, and it will let you update the routine like before. [Here's](https://www.figma.com/file/UV7RUrpCjvbhg4ObaQVTS5/GymRoutines-2?node-id=4%3A2) what it will look like.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.