Fix issue selecting a new exercise
This commit is contained in:
15
db.py
15
db.py
@@ -460,22 +460,23 @@ class DataBase():
|
||||
SELECT
|
||||
t.repetitions,
|
||||
t.weight,
|
||||
e.name as "exercise_name"
|
||||
e.name AS "exercise_name"
|
||||
FROM
|
||||
topset t JOIN workout w ON t.workout_id = w.workout_id
|
||||
JOIN exercise e ON t.exercise_id = e.exercise_id
|
||||
exercise e
|
||||
LEFT JOIN topset t ON e.exercise_id = t.exercise_id
|
||||
LEFT JOIN workout w ON t.workout_id = w.workout_id
|
||||
WHERE
|
||||
w.person_id = %s AND t.exercise_id = %s
|
||||
e.exercise_id = %s AND (w.person_id = %s OR w.person_id IS NULL)
|
||||
ORDER BY
|
||||
w.start_date DESC
|
||||
LIMIT 1;
|
||||
""", [person_id, exercise_id], one=True)
|
||||
""", [exercise_id, person_id], one=True)
|
||||
|
||||
if not topset:
|
||||
return None
|
||||
else:
|
||||
return (topset['repetitions'], topset['weight'], topset['exercise_name'])
|
||||
|
||||
return (topset.get('repetitions'), topset.get('weight'), topset['exercise_name'])
|
||||
|
||||
def get_all_exercises(self):
|
||||
exercises = self.execute(
|
||||
'SELECT exercise_id, name FROM exercise')
|
||||
|
||||
Reference in New Issue
Block a user