From 43717c874dc243b7ff019057b9c5ab86148f207d Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 4 Jul 2017 10:15:40 +0200 Subject: [PATCH] fixed c2 export error for coastal --- rowers/c2stuff.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rowers/c2stuff.py b/rowers/c2stuff.py index 7df1d228..d09dea9e 100644 --- a/rowers/c2stuff.py +++ b/rowers/c2stuff.py @@ -71,6 +71,8 @@ def c2_open(user): else: if (timezone.now()>r.tokenexpirydate): res = rower_c2_token_refresh(user) + if res == None: + raise C2NoTokenError("User has no token") if res[0] != None: thetoken = res[0] else: @@ -311,9 +313,12 @@ def createc2workoutdata(w): except ValueError: durationstr = datetime.strptime(str(w.duration),"%H:%M:%S") - + workouttype = w.workouttype + if workouttype in ('coastal','other'): + workouttype = 'water' + data = { - "type": w.workouttype, + "type": workouttype, "date": w.startdatetime.isoformat(), "timezone": "Etc/UTC", "distance": int(w.distance), @@ -595,7 +600,8 @@ def workout_c2_upload(user,w): c2id = 0 else: - message = "You are not authorized to upload this workout to Concept2" + print response.status_code + message = "Something went wrong in workout_c2_upload_view. Response code 200/201 but C2 sync failed: "+response.text c2id = 0 return message,c2id