Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2020-02-20 18:26:25 +01:00
2 changed files with 57 additions and 70 deletions
+13 -27
View File
@@ -508,28 +508,28 @@ def make_private(w,options):
return 1 return 1
def do_sync(w,options): def do_sync(w,options):
try:
upload_to_strava = options['upload_to_Strava']
except KeyError:
upload_to_strava = False
try: try:
if options['stravaid'] != 0 and options['stravaid'] != '': if options['stravaid'] != 0 and options['stravaid'] != '':
w.uploadedtostrava = options['stravaid'] w.uploadedtostrava = options['stravaid']
options['upload_to_Strava'] = False upload_to_strava = False
w.save() w.save()
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']): if ('upload_to_C2' in options and options['upload_to_C2']) or (w.user.c2_auto_export and ispromember(w.user.user)):
pass
else:
try: try:
message,id = c2stuff.workout_c2_upload(w.user.user,w) message,id = c2stuff.workout_c2_upload(w.user.user,w)
except NoTokenError: except NoTokenError:
id = 0 id = 0
message = "Something went wrong with the Concept2 sync" 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_Strava' in options and upload_to_strava) or (w.user.strava_auto_export and ispromember(w.user.user)):
if ('upload_to_Strava' in options and not options['upload_to_Strava']):
pass
else:
try: try:
message,id = stravastuff.workout_strava_upload( message,id = stravastuff.workout_strava_upload(
w.user.user,w w.user.user,w
@@ -539,11 +539,7 @@ def do_sync(w,options):
message = "Please connect to Strava first" 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)): if ('upload_to_SportTracks' in options and options['upload_to_SportTracks']) or (w.user.sporttracks_auto_export and ispromember(w.user.user)):
if ('upload_to_SportTracks' in options and not options['upload_to_SportTracks']):
pass
else:
try: try:
message,id = sporttracksstuff.workout_sporttracks_upload( message,id = sporttracksstuff.workout_sporttracks_upload(
w.user.user,w w.user.user,w
@@ -553,11 +549,7 @@ def do_sync(w,options):
id = 0 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_RunKeeper' in options and options['upload_to_RunKeeper']) or (w.user.runkeeper_auto_export and ispromember(w.user.user)):
if ('upload_to_RunKeeper' in options and not options['upload_to_RunKeeper']):
pass
else:
try: try:
message,id = runkeeperstuff.workout_runkeeper_upload( message,id = runkeeperstuff.workout_runkeeper_upload(
w.user.user,w w.user.user,w
@@ -566,10 +558,7 @@ def do_sync(w,options):
message = "Please connect to Runkeeper first" message = "Please connect to Runkeeper first"
id = 0 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 options['upload_to_MapMyFitness']) or (w.user.mapmyfitness_auto_export and ispromember(w.user.user)):
if ('upload_to_MapMyFitness' in options and not options['upload_to_MapMyFitness']):
pass
else:
try: try:
message,id = underarmourstuff.workout_ua_upload( message,id = underarmourstuff.workout_ua_upload(
w.user.user,w w.user.user,w
@@ -579,10 +568,7 @@ def do_sync(w,options):
id = 0 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 options['upload_to_TrainingPeaks']) or (w.user.trainingpeaks_auto_export and ispromember(w.user.user)):
if ('upload_to_TrainingPeaks' in options and not options['upload_to_TrainingPeaks']):
pass
else:
try: try:
message,id = tpstuff.workout_tp_upload( message,id = tpstuff.workout_tp_upload(
w.user.user,w w.user.user,w
+3 -2
View File
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
import hashlib import hashlib
from shutil import copyfile from shutil import copyfile
from six import iterlists
from rowers.views.statements import * from rowers.views.statements import *
import rowers.teams as teams import rowers.teams as teams
import rowers.mytypes as mytypes import rowers.mytypes as mytypes
@@ -4405,7 +4405,8 @@ def workout_upload_api(request):
secret = json_data['secret'] secret = json_data['secret']
post_data = json_data post_data = json_data
except (KeyError,JSONDecodeError): except (KeyError,JSONDecodeError):
post_data = request.POST q = request.POST
post_data = {k: q.getlist(k) if len(q.getlist(k))>1 else v for k, v in q.items()}
# only allow local host # only allow local host
hostt = request.get_host().split(':') hostt = request.get_host().split(':')