Fix for regression where selecting exercise for a new set on an exercise that hasnt had an set recorded wouldnt diplay the name

This commit is contained in:
Peter Stockings
2025-04-13 18:04:11 +10:00
parent 62e203bc2a
commit 3da0dc3b3d

View File

@@ -228,7 +228,8 @@ def get_most_recent_topset_for_exercise(person_id, workout_id):
return render_template('partials/new_set_form.html', person_id=person_id, workout_id=workout_id, exercises=exercises)
topset = db.get_most_recent_topset_for_exercise(person_id, exercise_id) # Keep using db.py for now
if not topset:
return render_template('partials/new_set_form.html', person_id=person_id, workout_id=workout_id, exercises=exercises, exercise_id=exercise_id)
exercise = db.execute("select name from exercise where exercise_id=%s", [exercise_id], one=True)
return render_template('partials/new_set_form.html', person_id=person_id, workout_id=workout_id, exercises=exercises, exercise_id=exercise_id, exercise_name=exercise['name'])
(repetitions, weight, exercise_name) = topset
return render_template('partials/new_set_form.html', person_id=person_id, workout_id=workout_id, exercise_id=exercise_id, exercise_name=exercise_name, repetitions=repetitions, weight=weight)