Add button to topsets to show history as a table
This commit is contained in:
22
db.py
22
db.py
@@ -380,6 +380,28 @@ class DataBase():
|
||||
return None
|
||||
else:
|
||||
return (topset.get('repetitions'), topset.get('weight'), topset['exercise_name'])
|
||||
|
||||
def get_recent_topsets_for_exercise(self, person_id, exercise_id, limit=5, offset=0):
|
||||
topsets = self.execute("""
|
||||
SELECT
|
||||
t.topset_id,
|
||||
t.repetitions,
|
||||
t.weight,
|
||||
w.start_date,
|
||||
w.workout_id,
|
||||
e.name AS "exercise_name"
|
||||
FROM
|
||||
exercise e
|
||||
JOIN topset t ON e.exercise_id = t.exercise_id
|
||||
JOIN workout w ON t.workout_id = w.workout_id
|
||||
WHERE
|
||||
e.exercise_id = %s AND w.person_id = %s
|
||||
ORDER BY
|
||||
w.start_date DESC, t.topset_id DESC
|
||||
LIMIT %s OFFSET %s;
|
||||
""", [exercise_id, person_id, limit, offset])
|
||||
|
||||
return topsets
|
||||
|
||||
def get_all_exercises(self):
|
||||
return self.exercises.get("")
|
||||
|
||||
Reference in New Issue
Block a user