Private
Public Access
1
0

Merge branch 'release/v11.24'

This commit is contained in:
Sander Roosendaal
2020-03-02 18:46:07 +01:00
5 changed files with 12 additions and 9 deletions

View File

@@ -1085,6 +1085,9 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
impeller=False):
message = None
if title is None:
title = 'Workout'
powerperc = 100 * np.array([r.pw_ut2,
r.pw_ut1,
r.pw_at,
@@ -1280,7 +1283,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
duplicate = True
# test title length
if len(title)>140:
if title is not None and len(title)>140:
title = title[0:140]
w = Workout(user=r, name=title, date=workoutdate,

View File

@@ -439,14 +439,14 @@ def createstravaworkoutdata(w,dozip=True):
# Upload the TCX file to Strava and set the workout activity type
# to rowing on Strava
def handle_stravaexport(f2,workoutname,stravatoken,description='',
activity_type='Rowing',async=False):
activity_type='Rowing',quick=False):
# w = Workout.objects.get(id=workoutid)
client = stravalib.Client(access_token=stravatoken)
act = client.upload_activity(f2,'tcx.gz',name=workoutname)
try:
if async:
if quick:
res = act.wait(poll_interval=1.0, timeout=10)
message = 'Workout successfully synchronized to Strava'
else:
@@ -625,7 +625,7 @@ def add_workout_from_data(user,importid,data,strokedata,
return id,message
def workout_strava_upload(user,w, async=False):
def workout_strava_upload(user,w, quick=False):
try:
thetoken = strava_open(user)
except NoTokenError:
@@ -648,7 +648,7 @@ def workout_strava_upload(user,w, async=False):
f,w.name,
r.stravatoken,
description=w.notes+'\n from '+w.workoutsource+' via rowsandall.com',
activity_type=r.stravaexportas,async=async)
activity_type=r.stravaexportas,quick=quick)
if res==0:
message = mes
w.uploadedtostrava = -1

View File

@@ -507,7 +507,7 @@ def make_private(w,options):
return 1
def do_sync(w,options, async=False):
def do_sync(w,options, quick=False):
try:
upload_to_strava = options['upload_to_Strava']
except KeyError:
@@ -532,7 +532,7 @@ def do_sync(w,options, async=False):
if ('upload_to_Strava' in options and upload_to_strava) or (w.user.strava_auto_export and ispromember(w.user.user)):
try:
message,id = stravastuff.workout_strava_upload(
w.user.user,w,async=async
w.user.user,w,quick=quick
)
except NoTokenError:
id = 0

View File

@@ -105,7 +105,7 @@ def workout_strava_upload_view(request,id=0):
f,w.name,
r.stravatoken,
description=newnotes,
activity_type=activity_type,async=False)
activity_type=activity_type,quick=False)
if res==0:
messages.error(request,mes)
w.uploadedtostrava = -1

View File

@@ -4500,7 +4500,7 @@ def workout_upload_api(request):
w = Workout.objects.get(id=id)
uploads.do_sync(w,post_data,async=True)
uploads.do_sync(w,post_data,quick=True)
if make_plot:
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)