diff --git a/rowers/c2stuff.py b/rowers/c2stuff.py index c0d53ec2..33c2ef2c 100644 --- a/rowers/c2stuff.py +++ b/rowers/c2stuff.py @@ -682,8 +682,11 @@ def createc2workoutdata(w): w.timezone = 'UTC' w.save() - wendtime = w.startdatetime.astimezone(pytz.timezone( - w.timezone))+datetime.timedelta(seconds=makeseconds(durationstr)) + try: + wendtime = w.startdatetime.astimezone(pytz.timezone( + w.timezone))+datetime.timedelta(seconds=makeseconds(durationstr)) + except UnknownTimeZoneError: + wendtime = w.startdatetime+datetime.timedelta(seconds=makeseconds(durationstr)) data = { "type": mytypes.c2mapping[workouttype], diff --git a/rowers/dataroutines.py b/rowers/dataroutines.py index c942b47a..94398d17 100644 --- a/rowers/dataroutines.py +++ b/rowers/dataroutines.py @@ -876,9 +876,10 @@ def checkduplicates(r, workoutdate, workoutstartdatetime, workoutenddatetime): t = ww.duration delta = datetime.timedelta( hours=t.hour, minutes=t.minute, seconds=t.second) - enddatetime = ww.startdatetime+delta - if enddatetime > workoutstartdatetime: - ws2.append(ww) + if ww.startdatetime is not None: + enddatetime = ww.startdatetime+delta + if enddatetime > workoutstartdatetime: + ws2.append(ww) if (len(ws2) != 0): duplicate = True diff --git a/rowers/views/apiviews.py b/rowers/views/apiviews.py index ebf51345..c04f605a 100644 --- a/rowers/views/apiviews.py +++ b/rowers/views/apiviews.py @@ -271,6 +271,13 @@ def strokedatajson_v3(request): startdatetime = pendulum.parse(startdatetime) + dologging('apilog.log',workouttype) + dologging('apilog.log',boattype) + dologging('apilog.log',notes) + dologging('apilog.log',title) + dologging('apilog.log',totalDistance) + dologging('apilog.log',elapsedTime) + df = pd.DataFrame() try: strokes = request.data['strokes'] @@ -298,7 +305,10 @@ def strokedatajson_v3(request): _ = data.to_csv(csvfilename, index_label='index', compression='gzip') duration = datetime.time(0,0,1) - w = Workout(user=request.user.rower,date=timezone.now().date(),duration=duration) + w = Workout( + user=request.user.rower, + date=timezone.now().date(), + duration=duration) w.save() uploadoptions = { diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index fa11f4cd..0e224487 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -5211,7 +5211,6 @@ def workout_upload_api(request): # sync related IDs c2id = post_data.get('c2id', '') workoutid = post_data.get('id','') - startdatetime = post_data.get('startdatetime', '') oarlockfirmware = post_data.get('oarlockfirmware', None) inboard = post_data.get('inboard', None)