From a9c4a5bb0ac93c01e4b7fb8e957e041b4901de0f Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 21 Jun 2021 08:14:02 +0200 Subject: [PATCH] fixing timezone glitches --- rowers/c2stuff.py | 4 ++++ rowers/models.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/rowers/c2stuff.py b/rowers/c2stuff.py index 24ce55e6..3001cd8c 100644 --- a/rowers/c2stuff.py +++ b/rowers/c2stuff.py @@ -700,6 +700,10 @@ def createc2workoutdata(w): if workouttype in otwtypes: workouttype = 'water' + if w.timezone == 'tzutc()': + w.timezone = 'UTC' + w.save() + wendtime = w.startdatetime.astimezone(pytz.timezone(w.timezone))+datetime.timedelta(seconds=makeseconds(durationstr)) diff --git a/rowers/models.py b/rowers/models.py index 55abd552..89cac53a 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -3236,6 +3236,9 @@ class Workout(models.Model): if not can_add_workout(user.user): raise forms.ValidationError("Free Coach User cannot have any workouts") + if self.timezone == 'tzutc()': + self.timezone = 'UTC' + super(Workout, self).save(*args, **kwargs) def __str__(self):