Private
Public Access
1
0

Merge branch 'develop' into feature/teamcompare

This commit is contained in:
Sander Roosendaal
2017-02-19 10:09:20 +01:00
4 changed files with 23 additions and 8 deletions

View File

@@ -207,8 +207,11 @@ def iscoachmember(user):
# Check if a user is a Pro member
def ispromember(user):
r = Rower.objects.get(user=user)
result = user.is_authenticated() and (r.rowerplan=='pro' or r.rowerplan=='coach')
if not user.is_anonymous():
r = Rower.objects.get(user=user)
result = user.is_authenticated() and (r.rowerplan=='pro' or r.rowerplan=='coach')
else:
result = False
return result
# User registration
@@ -800,11 +803,11 @@ def workout_strava_upload_view(request,id=0):
tcxfile = stravastuff.createstravaworkoutdata(w)
if tcxfile:
with open(tcxfile,'rb') as f:
res = stravastuff.handle_stravaexport(f,w.name,
res,mes = stravastuff.handle_stravaexport(f,w.name,
r.stravatoken,
description=w.notes)
if res==0:
message = "Strava Upload error: %s" % e
message = mes
w.uploadedtostrava = -1
w.save()
os.remove(tcxfile)
@@ -820,7 +823,7 @@ def workout_strava_upload_view(request,id=0):
w.save()
os.remove(tcxfile)
url = "/rowers/workout/"+str(w.id)+"/edit"
successmessage = 'Workout sent to Strava.'
successmessage = mes
except:
with open("media/stravaerrors.log","a") as errorlog:
errorstring = str(sys.exc_info()[0])