From c908d2c21e5758909af51698a1bf97119fc2050b Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 4 Jul 2017 10:05:40 +0200 Subject: [PATCH 1/2] added coastal to stats options form --- rowers/forms.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rowers/forms.py b/rowers/forms.py index abbf3863..0566c38c 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -285,6 +285,7 @@ class StatsOptionsForm(forms.Form): skierg = forms.BooleanField(initial=False,required=False) paddle = forms.BooleanField(initial=False,required=False) snow = forms.BooleanField(initial=False,required=False) + coastal = forms.BooleanField(initial=False,required=False) other = forms.BooleanField(initial=False,required=False) class WorkoutMultipleCompareForm(forms.Form): From 43717c874dc243b7ff019057b9c5ab86148f207d Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 4 Jul 2017 10:15:40 +0200 Subject: [PATCH 2/2] 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