added sync options
This commit is contained in:
@@ -75,10 +75,12 @@ class Command(BaseCommand):
|
|||||||
if uploadoptions and not 'error' in uploadoptions:
|
if uploadoptions and not 'error' in uploadoptions:
|
||||||
w = Workout.objects.get(wid[0])
|
w = Workout.objects.get(wid[0])
|
||||||
r = w.user
|
r = w.user
|
||||||
|
uploads.do_sync(w,uploadoptions)
|
||||||
if 'make_plot' in uploadoptions:
|
if 'make_plot' in uploadoptions:
|
||||||
plottype = uploadoptions['plottype']
|
plottype = uploadoptions['plottype']
|
||||||
res = uploads.make_plot(r,w,plottype,
|
res = uploads.make_plot(r,w,f2[6:],
|
||||||
title,f2[6:],f2)
|
w.csvfilename,
|
||||||
|
plottype,title)
|
||||||
try:
|
try:
|
||||||
if wid != 1:
|
if wid != 1:
|
||||||
dd = send_confirm(rr.user,title,link,
|
dd = send_confirm(rr.user,title,link,
|
||||||
@@ -106,10 +108,13 @@ class Command(BaseCommand):
|
|||||||
if uploadoptions:
|
if uploadoptions:
|
||||||
w = Workout.objects.get(wid[0])
|
w = Workout.objects.get(wid[0])
|
||||||
r = w.user
|
r = w.user
|
||||||
|
uploads.do_sync(w,uploadoptions)
|
||||||
if 'make_plot' in uploadoptions:
|
if 'make_plot' in uploadoptions:
|
||||||
plottype = uploadoptions['plottype']
|
plottype = uploadoptions['plottype']
|
||||||
res = uploads.make_plot(r,w,plottype,
|
res = uploads.make_plot(r,w,a.document,
|
||||||
title,f2[6:],f2)
|
w.csvfilename,
|
||||||
|
plottype,name)
|
||||||
|
|
||||||
|
|
||||||
except:
|
except:
|
||||||
# replace with code to process error
|
# replace with code to process error
|
||||||
|
|||||||
@@ -176,3 +176,64 @@ def make_plot(r,w,f1,f2,plottype,title,imagename='',plotnr=0):
|
|||||||
i.save()
|
i.save()
|
||||||
|
|
||||||
return i.id
|
return i.id
|
||||||
|
|
||||||
|
import c2stuff,stravastuff,sporttracksstuff,runkeeperstuff
|
||||||
|
import underarmourstuff,tpstuff
|
||||||
|
|
||||||
|
def do_sync(w,options):
|
||||||
|
if 'upload_to_C2' in options and options['upload_to_C2']:
|
||||||
|
try:
|
||||||
|
message,id = c2stuff.workout_c2_upload(w.user.user,w)
|
||||||
|
except C2NoTokenError:
|
||||||
|
id = 0
|
||||||
|
message = "Something went wrong with the Concept2 sync"
|
||||||
|
|
||||||
|
if 'upload_to_Strava' in options and options['upload_to_Strava']:
|
||||||
|
try:
|
||||||
|
message,id = stravastuff.workout_strava_upload(
|
||||||
|
w.user.user,w
|
||||||
|
)
|
||||||
|
except StravaNoTokenError:
|
||||||
|
id = 0
|
||||||
|
message = "Please connect to Strava first"
|
||||||
|
|
||||||
|
|
||||||
|
if 'upload_to_SportTracks' in options and options['upload_to_SportTracks']:
|
||||||
|
try:
|
||||||
|
message,id = sporttracksstuff.workout_sporttracks_upload(
|
||||||
|
w.user.user,w
|
||||||
|
)
|
||||||
|
except SportTracksNoTokenError:
|
||||||
|
message = "Please connect to SportTracks first"
|
||||||
|
id = 0
|
||||||
|
|
||||||
|
|
||||||
|
if 'upload_to_RunKeeper' in options and options['upload_to_RunKeeper']:
|
||||||
|
try:
|
||||||
|
message,id = runkeeperstuff.workout_runkeeper_upload(
|
||||||
|
w.user.user,w
|
||||||
|
)
|
||||||
|
except RunKeeperNoTokenError:
|
||||||
|
message = "Please connect to Runkeeper first"
|
||||||
|
id = 0
|
||||||
|
|
||||||
|
if 'upload_to_MapMyFitness' in options and options['upload_to_MapMyFitness']:
|
||||||
|
try:
|
||||||
|
message,id = underarmourstuff.workout_ua_upload(
|
||||||
|
w.user.user,w
|
||||||
|
)
|
||||||
|
except UnderArmourNoTokenError:
|
||||||
|
message = "Please connect to MapMyFitness first"
|
||||||
|
id = 0
|
||||||
|
|
||||||
|
|
||||||
|
if 'upload_to_TrainingPeaks' in options and options['upload_to_TrainingPeaks']:
|
||||||
|
try:
|
||||||
|
message,id = tpstuff.workout_tp_upload(
|
||||||
|
w.user.user,w
|
||||||
|
)
|
||||||
|
except TPNoTokenError:
|
||||||
|
message = "Please connect to TrainingPeaks first"
|
||||||
|
id = 0
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|||||||
Reference in New Issue
Block a user