summaryrefslogtreecommitdiff
path: root/app/tables
diff options
context:
space:
mode:
Diffstat (limited to 'app/tables')
-rw-r--r--app/tables/workout.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/tables/workout.py b/app/tables/workout.py
index cff0762..164f547 100644
--- a/app/tables/workout.py
+++ b/app/tables/workout.py
@@ -1,4 +1,9 @@
from app import db, login_manager
+import enum
+
+class ExerciseType(enum.Enum):
+ TIME = "Seconds"
+ REPS = "Reps"
# Represents an individual exercise
class Exercise(db.Model):
@@ -7,13 +12,15 @@ class Exercise(db.Model):
name = db.Column(db.String(100), nullable=False)
sets = db.Column(db.Integer)
units = db.Column(db.Integer)
+ type = db.Column(db.Enum(ExerciseType))
# Workout Relationship
workout_id = db.Column(db.Integer, db.ForeignKey('workouts.id'))
- def __init__(self, name, sets, units):
+ def __init__(self, name, sets, units, type):
self.name = name
self.sets = sets
- self.unit = units
+ self.units = units
+ self.type = type
def __repr__(self):
return f'<Exercise {self.name} {self.sets}x{self.units}>'
@@ -34,7 +41,8 @@ class Workout(db.Model):
# Create exercises
for exercise in exercises:
- self.exercises.append(Exercise(exercise['name'], exercise['sets'], exercise['units']))
+ type = ExerciseType.TIME if exercise['type'] == 'time'else ExerciseType.REPS;
+ self.exercises.append(Exercise(exercise['name'], exercise['sets'], exercise['units'], type))
def __repr__(self):
return f'<Workout {self.name}>'