From 3da0dc3b3d0456ca219521ac95c91488c0a53506 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Sun, 13 Apr 2025 18:04:11 +1000 Subject: [PATCH] Fix for regression where selecting exercise for a new set on an exercise that hasnt had an set recorded wouldnt diplay the name --- routes/workout.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routes/workout.py b/routes/workout.py index 732643b..f3f773e 100644 --- a/routes/workout.py +++ b/routes/workout.py @@ -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)