Show exercise weekly/monthly progress on exercise history table

This commit is contained in:
Peter Stockings
2026-02-26 23:53:47 +11:00
parent b31ab97cd4
commit 73e02a7b12
2 changed files with 33 additions and 3 deletions

View File

@@ -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/<int:person_id>/workout/<int:workout_id>", methods=['GET'])
def show_workout(person_id, workout_id):