Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Also add a random time to the dummy sessions

Roland Geideree26ccfe22be
diff --git a/extras/dummy_generator/generator.py b/extras/dummy_generator/generator.py
index 0b17d112b..1b3a7f82c 100644
--- a/extras/dummy_generator/generator.py
+++ b/extras/dummy_generator/generator.py
@@ -350,10 +350,16 @@ if hasattr(args, 'impression_sessions'):
if not WorkoutSession.objects.filter(user=user, date=date).exists():
workout = WorkoutLog.objects.filter(user=user, date=date).first().workout
+ start = datetime.time(hour=random.randint(8, 20), minute=random.randint(0, 59))
+ end = datetime.datetime.combine(datetime.date.today(), start) \
+ + datetime.timedelta(minutes=random.randint(40, 120))
+ end = datetime.time(hour=end.hour, minute=end.minute)
session = WorkoutSession()
session.date = date
session.user = user
+ session.time_start = start
+ session.time_end = end
session.workout = workout
if args.impression_sessions == 'good':