This commit is contained in:
Trey t
2023-06-24 00:01:45 -05:00
parent 9ad9179324
commit 26df876a7f
4 changed files with 21 additions and 1 deletions

Binary file not shown.

View File

@@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2023-06-24 04:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workout', '0006_completedworkout_notes'),
]
operations = [
migrations.AddField(
model_name='completedworkout',
name='total_calories',
field=models.FloatField(blank=True, null=True),
),
]

View File

@@ -71,6 +71,7 @@ class CompletedWorkout(models.Model):
total_time = models.IntegerField(null=True, blank=True) total_time = models.IntegerField(null=True, blank=True)
workout_start_time = models.DateTimeField(null=False, blank=False) workout_start_time = models.DateTimeField(null=False, blank=False)
notes = models.TextField(null=False, blank=False) notes = models.TextField(null=False, blank=False)
total_calories = models.FloatField(null=True, blank=True)
def __str__(self): def __str__(self):
return self.registered_user.first_name + " : " + self.registered_user.last_name + " : " + self.workout.name + " : " + str(self.difficulty) return self.registered_user.first_name + " : " + self.registered_user.last_name + " : " + self.workout.name + " : " + str(self.difficulty)

View File

@@ -28,7 +28,8 @@ class CompleteWorkoutSerializer(serializers.ModelSerializer):
difficulty=validated_data['difficulty'], difficulty=validated_data['difficulty'],
total_time=validated_data['total_time'], total_time=validated_data['total_time'],
workout_start_time=validated_data['workout_start_time'], workout_start_time=validated_data['workout_start_time'],
notes=validated_data['notes'] notes=validated_data['notes'],
total_calories=validated_data['total_calories']
) )
completed_workout.save() completed_workout.save()
return completed_workout return completed_workout