Private
Public Access
1
0

fixing timezone glitches

This commit is contained in:
Sander Roosendaal
2021-06-21 08:14:02 +02:00
parent 898ba0d16a
commit a9c4a5bb0a
2 changed files with 7 additions and 0 deletions

View File

@@ -700,6 +700,10 @@ def createc2workoutdata(w):
if workouttype in otwtypes: if workouttype in otwtypes:
workouttype = 'water' workouttype = 'water'
if w.timezone == 'tzutc()':
w.timezone = 'UTC'
w.save()
wendtime = w.startdatetime.astimezone(pytz.timezone(w.timezone))+datetime.timedelta(seconds=makeseconds(durationstr)) wendtime = w.startdatetime.astimezone(pytz.timezone(w.timezone))+datetime.timedelta(seconds=makeseconds(durationstr))

View File

@@ -3236,6 +3236,9 @@ class Workout(models.Model):
if not can_add_workout(user.user): if not can_add_workout(user.user):
raise forms.ValidationError("Free Coach User cannot have any workouts") raise forms.ValidationError("Free Coach User cannot have any workouts")
if self.timezone == 'tzutc()':
self.timezone = 'UTC'
super(Workout, self).save(*args, **kwargs) super(Workout, self).save(*args, **kwargs)
def __str__(self): def __str__(self):