feat: assign tags to exercises and show muscle distribution of workout

This commit is contained in:
Peter Stockings
2026-01-30 23:53:04 +11:00
parent 78f4a53c49
commit d03581bff4
10 changed files with 278 additions and 60 deletions

19
db.py
View File

@@ -66,22 +66,17 @@ class DataBase():
def get_exercise(self, exercise_id):
exercise = self.execute(
'SELECT exercise_id, name FROM exercise WHERE exercise_id=%s LIMIT 1', [exercise_id], one=True)
return exercise
return self.exercises.get_exercise(exercise_id)
def create_exercise(self, name):
new_exercise = self.execute('INSERT INTO exercise (name) VALUES (%s) RETURNING exercise_id AS "ExerciseId"',
[name], commit=True, one=True)
return new_exercise['ExerciseId']
def create_exercise(self, name, attribute_ids=None):
return self.exercises.add_exercise(name, attribute_ids)
def delete_exercise(self, exercise_id):
self.execute('DELETE FROM exercise WHERE exercise_id=%s', [
exercise_id], commit=True)
def update_exercise(self, exercise_id, name):
self.execute('UPDATE Exercise SET Name=%s WHERE exercise_id=%s', [
name, exercise_id], commit=True)
def update_exercise(self, exercise_id, name, attribute_ids=None):
return self.exercises.update_exercise(exercise_id, name, attribute_ids)
def get_people(self):
people = self.execute(
@@ -382,9 +377,7 @@ class DataBase():
return (topset.get('repetitions'), topset.get('weight'), topset['exercise_name'])
def get_all_exercises(self):
exercises = self.execute(
'SELECT exercise_id, name FROM exercise')
return exercises
return self.exercises.get("")
def get_exercise_progress_for_user(self, person_id, exercise_id, min_date=None, max_date=None, epoch='all', degree=1):
today = datetime.now()