Start to refactor away from using camel case (Not sure why I did this in the first place)

This commit is contained in:
Peter Stockings
2023-12-09 16:14:10 +11:00
parent cc31cb098d
commit d967920e03
7 changed files with 18 additions and 36 deletions

10
db.py
View File

@@ -52,11 +52,6 @@ class DataBase():
return (rv[0] if rv else None) if one else rv
def get_exercises(self):
exercises = self.execute(
'SELECT exercise_id AS "ExerciseId", name AS "Name" FROM exercise')
return [{"ExerciseId": e['ExerciseId'], "Name": e['Name']} for e in exercises]
def get_exercise(self, exercise_id):
exercise = self.execute(
'SELECT exercise_id AS "ExerciseId", name AS "Name" FROM exercise WHERE exercise_id=%s LIMIT 1', [exercise_id], one=True)
@@ -503,10 +498,11 @@ class DataBase():
# Calculate viewBox dimensions
date_range = max_date - min_date
total_span = date_range.days or 1
e1rm_range = (max_e1rm - min_e1rm) or 1
reps_range = (max_reps - min_reps) or 1
weight_range = (max_weight - min_weight) or 1
vb_width, vb_height = date_range.days, e1rm_range
vb_width, vb_height = total_span, e1rm_range
vb_width *= 200 / vb_width # Scale to 200px width
vb_height *= 75 / vb_height # Scale to 75px height
@@ -514,7 +510,7 @@ class DataBase():
estimated_1rm_scaled = [((value - min_e1rm) / e1rm_range) * vb_height for value in estimated_1rm]
repetitions_scaled = [((value - min_reps) / reps_range) * vb_height for value in repetitions]
weight_scaled = [((value - min_weight) / weight_range) * vb_height for value in weight]
total_span = date_range.days or 1
relative_positions = [(date - min_date).days / total_span for date in start_dates]
# Convert relative positions and scaled estimated 1RM values to numpy arrays