From 73e02a7b12d44cedd0946b420da84fc07a365481 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Thu, 26 Feb 2026 23:53:47 +1100 Subject: [PATCH] Show exercise weekly/monthly progress on exercise history table --- routes/workout.py | 22 +++++++++++++++++++++- templates/partials/exercise_history.html | 14 ++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/routes/workout.py b/routes/workout.py index f980a7f..32cae2e 100644 --- a/routes/workout.py +++ b/routes/workout.py @@ -303,6 +303,22 @@ def get_exercise_history(person_id, exercise_id): source_topset_id = request.args.get('source_topset_id', type=int) topsets = db.get_recent_topsets_for_exercise(person_id, exercise_id, limit, offset) + + title = "History" + best_fit_formula = None + latest_workout_id = None + latest_topset_id = None + + if topsets: + # Fetch progress data to get title and best_fit_formula if there's history + exercise_progress = db.get_exercise_progress_for_user( + person_id, exercise_id, epoch='all') + + if exercise_progress: + title = exercise_progress.get('title', "History") + best_fit_formula = exercise_progress.get('best_fit_formula') + latest_workout_id = exercise_progress.get('latest_workout_id') + latest_topset_id = exercise_progress.get('latest_topset_id') return render_template('partials/exercise_history.html', person_id=person_id, @@ -310,7 +326,11 @@ def get_exercise_history(person_id, exercise_id): topsets=topsets, limit=limit, offset=offset, - source_topset_id=source_topset_id) + source_topset_id=source_topset_id, + title=title, + best_fit_formula=best_fit_formula, + latest_workout_id=latest_workout_id, + latest_topset_id=latest_topset_id) @workout_bp.route("/person//workout/", methods=['GET']) def show_workout(person_id, workout_id): diff --git a/templates/partials/exercise_history.html b/templates/partials/exercise_history.html index 1240abf..7bd7099 100644 --- a/templates/partials/exercise_history.html +++ b/templates/partials/exercise_history.html @@ -1,9 +1,12 @@ {% if offset == 0 %}
-
+
-

History

+

{{ title }}

+
+
+ {% if best_fit_formula %} +

+ {{ best_fit_formula.kg_per_week }} kg/week, {{ best_fit_formula.kg_per_month }} kg/month +

+ {% else %} +
+ {% endif %}