Private
Public Access
1
0

add match option to stravaexportas

This commit is contained in:
Sander Roosendaal
2021-02-10 20:17:48 +01:00
parent 103a946fe7
commit bc0d34e78c
3 changed files with 24 additions and 4 deletions

View File

@@ -752,23 +752,36 @@ def workout_strava_upload(user,w, quick=False,asynchron=True):
tcxfile, tcxmesg = createstravaworkoutdata(w)
if not tcxfile:
return "Failed to create workout data",0
activity_type = r.stravaexportas
if r.stravaexportas == 'match':
try:
activity_type = mytypes.stravamapping[w.workouttype]
except KeyError:
activity_type = 'Rowing'
job = myqueue(queue,
handle_strava_sync,
r.stravatoken,
w.id,
tcxfile,w.name,r.stravaexportas,
tcxfile,w.name,activity_type,
w.notes
)
return "Asynchronous sync",-1
try:
tcxfile,tcxmesg = createstravaworkoutdata(w)
if tcxfile:
activity_type = r.stravaexportas
if r.stravaexportas == 'match':
try:
activity_type = mytypes.stravamapping[w.workouttype]
except KeyError:
activity_type = 'Rowing'
print(w.workouttype,activity_type)
with open(tcxfile,'rb') as f:
res,mes = handle_stravaexport(
f,w.name,
r.stravatoken,
description=w.notes+'\n from '+w.workoutsource+' via rowsandall.com',
activity_type=r.stravaexportas,quick=quick,asynchron=asynchron)
activity_type=activity_type,quick=quick,asynchron=asynchron)
if res==0:
message = mes
w.uploadedtostrava = -1