diff --git a/db.py b/db.py
index c59969f..81eeaed 100644
--- a/db.py
+++ b/db.py
@@ -226,7 +226,8 @@ class DataBase():
E.ExerciseId AS "ExerciseId",
E.Name AS "ExerciseName",
T.Repetitions AS "Repetitions",
- T.Weight AS "Weight"
+ T.Weight AS "Weight",
+ round((100 * T.Weight)/(101.3-2.67123 * T.Repetitions),0)::numeric::integer AS "Estimated1RM"
FROM Person P
LEFT JOIN Workout W ON P.PersonId=W.PersonId
LEFT JOIN TopSet T ON W.WorkoutId=T.WorkoutId
diff --git a/templates/base.html b/templates/base.html
index 239f608..a80f738 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -7,6 +7,12 @@
Workout Tracker
+
+
diff --git a/templates/index.html b/templates/index.html
index e846808..15dbb62 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -2,6 +2,17 @@
{% block content %}
+
+
{% for p in model %}
@@ -23,6 +34,16 @@
{{ e['ExerciseName'] }}
+
+
diff --git a/utils.py b/utils.py
index 0d649a1..7cda24e 100644
--- a/utils.py
+++ b/utils.py
@@ -1,4 +1,5 @@
from datetime import datetime
+import json
def get_workouts(topsets):
@@ -48,17 +49,23 @@ def get_rep_maxes_for_person(person_topsets):
topsets_for_exercise.append({
'StartDate': max_topset_for_rep[0]['StartDate'],
'Repetitions': rep,
- 'Weight': max_weight
+ 'Weight': max_weight,
+ 'Estimated1RM': max_topset_for_rep[0]['Estimated1RM'],
})
# datetime.strptime(x['StartDate'], "%Y-%m-%d")
topsets_for_exercise.sort(
- key=lambda x: x['StartDate'], reverse=True)
+ key=lambda x: x['Repetitions'], reverse=True)
rep_maxes_in_exercises.append({
'ExerciseId': e['ExerciseId'],
'ExerciseName': e['ExerciseName'],
'RepMaxes': topsets_for_exercise,
+ 'EstimatedOneRepMaxProgressions': {
+ 'StartDates': json.dumps([t['StartDate'] for t in exercise_topsets]),
+ 'TopSets': json.dumps([f"{t['Repetitions']} x {t['Weight']}kg" for t in exercise_topsets]),
+ 'Estimated1RMs': json.dumps([t['Estimated1RM'] for t in exercise_topsets]),
+ }
})
return rep_maxes_in_exercises