Merge branch 'release/v11.08'
This commit is contained in:
@@ -516,79 +516,60 @@ def do_sync(w,options):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export and ispromember(w.user)):
|
|
||||||
if ('upload_to_C2' in options and not options['upload_to_C2']):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
message,id = c2stuff.workout_c2_upload(w.user.user,w)
|
|
||||||
except NoTokenError:
|
|
||||||
id = 0
|
|
||||||
message = "Something went wrong with the Concept2 sync"
|
|
||||||
|
|
||||||
if ('upload_to_Strava' in options and options['upload_to_Strava']) or (w.user.strava_auto_export and ispromember(w.user)):
|
if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export and ispromember(w.user.user)):
|
||||||
if ('upload_to_Strava' in options and not options['upload_to_Strava']):
|
try:
|
||||||
pass
|
message,id = c2stuff.workout_c2_upload(w.user.user,w)
|
||||||
else:
|
except NoTokenError:
|
||||||
try:
|
id = 0
|
||||||
message,id = stravastuff.workout_strava_upload(
|
message = "Something went wrong with the Concept2 sync"
|
||||||
|
|
||||||
|
if ('upload_to_Strava' in options and options['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
|
||||||
|
)
|
||||||
|
except NoTokenError:
|
||||||
|
id = 0
|
||||||
|
message = "Please connect to Strava first"
|
||||||
|
|
||||||
|
|
||||||
|
if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export and ispromember(w.user.user)):
|
||||||
|
try:
|
||||||
|
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||||
w.user.user,w
|
w.user.user,w
|
||||||
)
|
)
|
||||||
except NoTokenError:
|
except NoTokenError:
|
||||||
id = 0
|
message = "Please connect to SportTracks first"
|
||||||
message = "Please connect to Strava first"
|
id = 0
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export and ispromember(w.user)):
|
if ('upload_to_RunKeeper' in options and options['upload_to_RunKeeper']) or (w.user.runkeeper_auto_export and ispromember(w.user.user)):
|
||||||
if ('upload_to_SportTracks' in options and not options['upload_to_SportTracks']):
|
try:
|
||||||
pass
|
message,id = runkeeperstuff.workout_runkeeper_upload(
|
||||||
else:
|
w.user.user,w
|
||||||
|
)
|
||||||
|
except NoTokenError:
|
||||||
|
message = "Please connect to Runkeeper first"
|
||||||
|
id = 0
|
||||||
|
|
||||||
try:
|
if ('upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']) or (w.user.mapmyfitness_auto_export and ispromember(w.user.user)):
|
||||||
message,id = sporttracksstuff.workout_sporttracks_upload(
|
try:
|
||||||
w.user.user,w
|
message,id = underarmourstuff.workout_ua_upload(
|
||||||
)
|
w.user.user,w
|
||||||
except NoTokenError:
|
)
|
||||||
message = "Please connect to SportTracks first"
|
except NoTokenError:
|
||||||
id = 0
|
message = "Please connect to MapMyFitness first"
|
||||||
|
id = 0
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_RunKeeper' in options and options['upload_to_RunKeeper']) or (w.user.runkeeper_auto_export and ispromember(w.user)):
|
if ('upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']) or (w.user.trainingpeaks_auto_export and ispromember(w.user.user)):
|
||||||
if ('upload_to_RunKeeper' in options and not options['upload_to_RunKeeper']):
|
try:
|
||||||
pass
|
message,id = tpstuff.workout_tp_upload(
|
||||||
else:
|
w.user.user,w
|
||||||
|
)
|
||||||
try:
|
except NoTokenError:
|
||||||
message,id = runkeeperstuff.workout_runkeeper_upload(
|
message = "Please connect to TrainingPeaks first"
|
||||||
w.user.user,w
|
id = 0
|
||||||
)
|
|
||||||
except NoTokenError:
|
|
||||||
message = "Please connect to Runkeeper first"
|
|
||||||
id = 0
|
|
||||||
|
|
||||||
if ('upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']) or (w.user.mapmyfitness_auto_export and ispromember(w.user)):
|
|
||||||
if ('upload_to_MapMyFitness' in options and not options['upload_to_MapMyFitness']):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
message,id = underarmourstuff.workout_ua_upload(
|
|
||||||
w.user.user,w
|
|
||||||
)
|
|
||||||
except NoTokenError:
|
|
||||||
message = "Please connect to MapMyFitness first"
|
|
||||||
id = 0
|
|
||||||
|
|
||||||
|
|
||||||
if ('upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']) or (w.user.trainingpeaks_auto_export and ispromember(w.user)):
|
|
||||||
if ('upload_to_TrainingPeaks' in options and not options['upload_to_TrainingPeaks']):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
message,id = tpstuff.workout_tp_upload(
|
|
||||||
w.user.user,w
|
|
||||||
)
|
|
||||||
except NoTokenError:
|
|
||||||
message = "Please connect to TrainingPeaks first"
|
|
||||||
id = 0
|
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import rowers.teams as teams
|
|||||||
import rowers.mytypes as mytypes
|
import rowers.mytypes as mytypes
|
||||||
import numpy
|
import numpy
|
||||||
from rowers.mailprocessing import send_confirm
|
from rowers.mailprocessing import send_confirm
|
||||||
|
import rowers.uploads as uploads
|
||||||
|
|
||||||
from urllib.parse import urlparse, parse_qs
|
from urllib.parse import urlparse, parse_qs
|
||||||
from json.decoder import JSONDecodeError
|
from json.decoder import JSONDecodeError
|
||||||
@@ -4504,49 +4505,12 @@ def workout_upload_api(request):
|
|||||||
return JSONResponse(status=200,data=message)
|
return JSONResponse(status=200,data=message)
|
||||||
|
|
||||||
w = Workout.objects.get(id=id)
|
w = Workout.objects.get(id=id)
|
||||||
if len(stravaid)>0:
|
|
||||||
w.uploadedtostrava = stravaid
|
|
||||||
w.save()
|
|
||||||
|
|
||||||
|
uploads.do_sync(w,post_data)
|
||||||
|
|
||||||
if make_plot:
|
if make_plot:
|
||||||
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
res, jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
|
||||||
|
|
||||||
if upload_to_c2:
|
|
||||||
try:
|
|
||||||
message,id = c2stuff.workout_c2_upload(r.user,w)
|
|
||||||
except NoTokenError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if upload_to_strava and stravaid == '':
|
|
||||||
try:
|
|
||||||
message,id = stravastuff.workout_strava_upload(r.user,w)
|
|
||||||
except NoTokenError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if upload_to_st:
|
|
||||||
try:
|
|
||||||
message,id = sporttrackstuff.workout_sporttracks_upload(r.user,w)
|
|
||||||
except NoTokenError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if upload_to_rk:
|
|
||||||
try:
|
|
||||||
message,id = runkeeperstuff.workout_runkeeper_upload(r.user,w)
|
|
||||||
except NoTokenError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if upload_to_ua:
|
|
||||||
try:
|
|
||||||
message,id = underarmourstuff.workout_ua_upload(r.user,w)
|
|
||||||
except NoTokenError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if upload_to_tp:
|
|
||||||
try:
|
|
||||||
message,id = tpstuff.workout_tp_upload(r.user,w)
|
|
||||||
except NoTokenError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
else: # form invalid
|
else: # form invalid
|
||||||
if fstr:
|
if fstr:
|
||||||
@@ -4575,9 +4539,6 @@ def workout_upload_api(request):
|
|||||||
return JSONResponse(status=statuscode,data=message)
|
return JSONResponse(status=statuscode,data=message)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# This is the main view for processing uploaded files
|
# This is the main view for processing uploaded files
|
||||||
@login_required()
|
@login_required()
|
||||||
def workout_upload_view(request,
|
def workout_upload_view(request,
|
||||||
|
|||||||
Reference in New Issue
Block a user