Add button to topsets to show history as a table

This commit is contained in:
Peter Stockings
2026-02-26 23:26:49 +11:00
parent 67009c9603
commit 895b813a35
4 changed files with 127 additions and 19 deletions

View File

@@ -296,6 +296,22 @@ def get_most_recent_topset_for_exercise(person_id, workout_id):
(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)
@workout_bp.route("/person/<int:person_id>/exercise/<int:exercise_id>/history", methods=['GET'])
def get_exercise_history(person_id, exercise_id):
limit = request.args.get('limit', type=int, default=5)
offset = request.args.get('offset', type=int, default=0)
source_topset_id = request.args.get('source_topset_id', type=int)
topsets = db.get_recent_topsets_for_exercise(person_id, exercise_id, limit, offset)
return render_template('partials/exercise_history.html',
person_id=person_id,
exercise_id=exercise_id,
topsets=topsets,
limit=limit,
offset=offset,
source_topset_id=source_topset_id)
@workout_bp.route("/person/<int:person_id>/workout/<int:workout_id>", methods=['GET'])
def show_workout(person_id, workout_id):
# Use the local helper function to get the view model