fixed c2 export error for coastal
This commit is contained in:
@@ -71,6 +71,8 @@ def c2_open(user):
|
|||||||
else:
|
else:
|
||||||
if (timezone.now()>r.tokenexpirydate):
|
if (timezone.now()>r.tokenexpirydate):
|
||||||
res = rower_c2_token_refresh(user)
|
res = rower_c2_token_refresh(user)
|
||||||
|
if res == None:
|
||||||
|
raise C2NoTokenError("User has no token")
|
||||||
if res[0] != None:
|
if res[0] != None:
|
||||||
thetoken = res[0]
|
thetoken = res[0]
|
||||||
else:
|
else:
|
||||||
@@ -311,9 +313,12 @@ def createc2workoutdata(w):
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
durationstr = datetime.strptime(str(w.duration),"%H:%M:%S")
|
durationstr = datetime.strptime(str(w.duration),"%H:%M:%S")
|
||||||
|
|
||||||
|
workouttype = w.workouttype
|
||||||
|
if workouttype in ('coastal','other'):
|
||||||
|
workouttype = 'water'
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
"type": w.workouttype,
|
"type": workouttype,
|
||||||
"date": w.startdatetime.isoformat(),
|
"date": w.startdatetime.isoformat(),
|
||||||
"timezone": "Etc/UTC",
|
"timezone": "Etc/UTC",
|
||||||
"distance": int(w.distance),
|
"distance": int(w.distance),
|
||||||
@@ -595,7 +600,8 @@ def workout_c2_upload(user,w):
|
|||||||
c2id = 0
|
c2id = 0
|
||||||
|
|
||||||
else:
|
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
|
c2id = 0
|
||||||
|
|
||||||
return message,c2id
|
return message,c2id
|
||||||
|
|||||||
Reference in New Issue
Block a user