When you select an exercise for a new topset autofill the reps/weight feilds with the most recent topset values if possible (I beleive I have introduced a minor defect where adding a new set no longer clears reps/weight feild, but for some reason still clears exercise)
This commit is contained in:
19
app.py
19
app.py
@@ -173,7 +173,8 @@ def get_workout_modal(person_id, workout_id):
|
||||
workout = db.get_workout(person_id, workout_id)
|
||||
(person_tags, workout_tags, selected_workout_tag_ids) = db.get_workout_tags(
|
||||
person_id, workout_id)
|
||||
return render_template('partials/workout_modal.html', workout=workout, person_tags=person_tags, workout_tags=workout_tags, selected_workout_tag_ids=selected_workout_tag_ids)
|
||||
exercises = db.get_all_exercises()
|
||||
return render_template('partials/workout_modal.html', workout=workout, person_tags=person_tags, workout_tags=workout_tags, selected_workout_tag_ids=selected_workout_tag_ids, exercises=exercises)
|
||||
|
||||
|
||||
@ app.route("/person/<int:person_id>/workout", methods=['POST'])
|
||||
@@ -404,6 +405,22 @@ def create_new_tag_for_workout(person_id, workout_id):
|
||||
return render_template('partials/workout_tags_list.html', workout_tags=workout_tags)
|
||||
|
||||
|
||||
@ app.route("/person/<int:person_id>/workout/<int:workout_id>/exercise/most_recent_topset_for_exercise", methods=['GET'])
|
||||
def get_most_recent_topset_for_exercise(person_id, workout_id):
|
||||
exercise_id = request.args.get('exercise_id', type=int)
|
||||
exercises = db.get_all_exercises()
|
||||
|
||||
if not exercise_id:
|
||||
return render_template('partials/new_set_form.html', person_id=person_id, workout_id=workout_id, exercises=exercises, has_value=False)
|
||||
|
||||
topset = db.get_most_recent_topset_for_exercise(person_id, exercise_id)
|
||||
if not topset:
|
||||
return render_template('partials/new_set_form.html', person_id=person_id, workout_id=workout_id, exercises=exercises, has_value=False)
|
||||
|
||||
(repetitions, weight) = topset
|
||||
return render_template('partials/new_set_form.html', person_id=person_id, workout_id=workout_id, exercises=exercises, has_value=True, exercise_id=exercise_id, repetitions=repetitions, weight=weight)
|
||||
|
||||
|
||||
# # TODO: Remove me, just for testing
|
||||
# @ app.route("/sparkline", methods=['GET'])
|
||||
# def get_sparkline():
|
||||
|
||||
Reference in New Issue
Block a user