From d44582d2a2f9236b8719a756a3d3a8df7664653c Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Sun, 2 Apr 2023 23:02:51 +1000 Subject: [PATCH] WIP: Plot estimated 1rm on graphs as well, perhaps add another graph with graph options(reps, weight, 1rms etc) --- templates/partials/page/person.html | 18 +++++++++++++++++- utils.py | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/templates/partials/page/person.html b/templates/partials/page/person.html index 2875fba..03ee730 100644 --- a/templates/partials/page/person.html +++ b/templates/partials/page/person.html @@ -189,6 +189,13 @@ name: 'Weight', yaxis: 'y2', type: 'scatter' + }, + { + x: {{ exercise_graph['StartDates'] | replace('"', "'") | safe }}, + y: {{ exercise_graph['Estimated1RM'] | replace('"', "'") | safe }}, + name: 'Estimated 1RM', + yaxis: 'y3', + type: 'scatter' } ], { @@ -198,7 +205,16 @@ yaxis2: { title: 'Weight', overlaying: 'y', - side: 'right', showgrid: false + side: 'right', + showgrid: false, + position: 0.96 + }, + yaxis3: { + title: 'Estimated 1RM', + overlaying: 'y', + side: 'right', + showgrid: false, + position: 1.00 } }, config); diff --git a/utils.py b/utils.py index 528f7e8..0eb5c15 100644 --- a/utils.py +++ b/utils.py @@ -15,7 +15,7 @@ def get_workouts(topsets): workouts.append({ 'WorkoutId': workout_id, 'StartDate': topsets_in_workout[0]['StartDate'], - 'TopSets': [{"TopSetId": t['TopSetId'], "ExerciseId": t['ExerciseId'], "ExerciseName": t['ExerciseName'], "Weight": t['Weight'], "Repetitions": t['Repetitions']} for t in topsets_in_workout if t['TopSetId'] is not None] + 'TopSets': [{"TopSetId": t['TopSetId'], "ExerciseId": t['ExerciseId'], "ExerciseName": t['ExerciseName'], "Weight": t['Weight'], "Repetitions": t['Repetitions'], "Estimated1RM": t['Estimated1RM']} for t in topsets_in_workout if t['TopSetId'] is not None] }) workouts.sort(key=lambda x: x['StartDate'], reverse=True)