Private
Public Access
1
0

Merge branch 'develop' into feature/braintree

This commit is contained in:
Sander Roosendaal
2018-12-15 15:52:01 +01:00
10 changed files with 142 additions and 18 deletions

View File

@@ -1115,6 +1115,8 @@ def checkouts_view(request):
def rower_register_view(request):
nextpage = request.GET.get('next','/rowers/list-workouts/')
if nextpage == '':
nextpage = '/rowers/list-workouts/'
if request.method == 'POST':
#form = RegistrationFormUniqueEmail(request.POST)
@@ -1128,6 +1130,7 @@ def rower_register_view(request):
sex = form.cleaned_data['sex']
birthdate = form.cleaned_data['birthdate']
weightcategory = form.cleaned_data['weightcategory']
adaptiveclass = form.cleaned_data['adaptiveclass']
nextpage = request.POST['next']
theuser = User.objects.create_user(username,password=password)
theuser.first_name = first_name
@@ -1136,7 +1139,8 @@ def rower_register_view(request):
theuser.save()
therower = Rower(user=theuser,sex=sex,birthdate=birthdate,
weightcategory=weightcategory)
weightcategory=weightcategory,
adaptiveclass=adaptiveclass)
therower.save()
@@ -3465,6 +3469,7 @@ def addmanual_view(request):
workouttype = form.cleaned_data['workouttype']
duration = form.cleaned_data['duration']
weightcategory = form.cleaned_data['weightcategory']
adaptiveclass = form.cleaned_data['adaptiveclass']
distance = form.cleaned_data['distance']
notes = form.cleaned_data['notes']
thetimezone = form.cleaned_data['timezone']
@@ -3514,6 +3519,7 @@ def addmanual_view(request):
distance,
duration,startdatetime,
weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
avghr=avghr,
rankingpiece=rankingpiece,
avgpwr=avgpwr,
@@ -3533,6 +3539,7 @@ def addmanual_view(request):
w.rankingpiece = rankingpiece
w.privacy = privacy
w.weightcategory = weightcategory
w.adaptiveclass = adaptiveclass
w.notes = notes
w.plannedsession = ps
w.name = name
@@ -3650,7 +3657,8 @@ def rankings_view(request,theuser=0,
worldclasspower = int(metrics.getagegrouprecord(
age,
sex=r.sex,
weightcategory=r.weightcategory
weightcategory=r.weightcategory,
adaptiveclass=r.adaptiveclass,
))
else:
worldclasspower = None
@@ -10127,6 +10135,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
starttime = form.cleaned_data['starttime']
workouttype = form.cleaned_data['workouttype']
weightcategory = form.cleaned_data['weightcategory']
adaptiveclass = form.cleaned_data['adaptiveclass']
duration = form.cleaned_data['duration']
distance = form.cleaned_data['distance']
private = form.cleaned_data['private']
@@ -10191,6 +10200,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
row.startdatetime = startdatetime
row.workouttype = workouttype
row.weightcategory = weightcategory
row.adaptiveclass = adaptiveclass
row.notes = notes
row.duration = duration
row.distance = distance
@@ -13220,6 +13230,7 @@ def rower_edit_view(request,rowerid=0,userid=0,message=""):
last_name = ucd['last_name']
email = ucd['email']
sex = cd['sex']
adaptiveclass = cd['adaptiveclass']
defaultlandingpage = cd['defaultlandingpage']
weightcategory = cd['weightcategory']
birthdate = cd['birthdate']
@@ -13243,6 +13254,7 @@ def rower_edit_view(request,rowerid=0,userid=0,message=""):
u.save()
r.defaulttimezone=defaulttimezone
r.weightcategory = weightcategory
r.adaptiveclass = adaptiveclass
r.getemailnotifications = getemailnotifications
r.getimportantemails = getimportantemails
r.defaultlandingpage = defaultlandingpage
@@ -13523,6 +13535,7 @@ def rower_prefs_view(request,userid=0,message=""):
sex = cd['sex']
defaultlandingpage = cd['defaultlandingpage']
weightcategory = cd['weightcategory']
adaptiveclass = cd['adaptiveclass']
birthdate = cd['birthdate']
showfavoritechartnotes = cd['showfavoritechartnotes']
getemailnotifications = cd['getemailnotifications']
@@ -13544,6 +13557,7 @@ def rower_prefs_view(request,userid=0,message=""):
u.save()
r.defaulttimezone=defaulttimezone
r.weightcategory = weightcategory
r.adaptiveclass = adaptiveclass
r.getemailnotifications = getemailnotifications
r.getimportantemails = getimportantemails
r.defaultlandingpage = defaultlandingpage
@@ -15443,7 +15457,7 @@ def plannedsessions_view(request,
totals['time'] = int(totals['time']/60.)
totals['actualtime'] = int(totals['actualtime']/60.)
totals['plannedtime'] = int(totals['plannedtime']/60.)
totals['plannedtime'] = int(totals['plannedtime'])
unmatchedworkouts = Workout.objects.filter(
user=r,
@@ -16404,6 +16418,15 @@ def virtualevent_view(request,id=0):
buttons = []
# to-do - add DNS
dns = []
if timezone.now() > race.evaluation_closure:
dns = resultobj.objects.filter(
race=race,
workoutid__isnull=True,
)
if not request.user.is_anonymous():
if race_can_register(r,race):
buttons += ['registerbutton']
@@ -16453,6 +16476,11 @@ def virtualevent_view(request,id=0):
except KeyError:
weightcategory = ['hwt','lwt']
try:
adaptiveclass = cd['adaptiveclass']
except KeyError:
adaptiveclass = ['None','PR1','PR2','PR3','FES']
if race.sessiontype == 'race':
results = resultobj.objects.filter(
race=race,
@@ -16461,6 +16489,7 @@ def virtualevent_view(request,id=0):
boattype__in=boattype,
sex__in=sex,
weightcategory__in=weightcategory,
adaptiveclass__in=adaptiveclass,
age__gte=age_min,
age__lte=age_max
).order_by("duration")
@@ -16471,6 +16500,7 @@ def virtualevent_view(request,id=0):
boatclass__in=boatclass,
sex__in=sex,
weightcategory__in=weightcategory,
adaptiveclass__in=adaptiveclass,
age__gte=age_min,
age__lte=age_max
).order_by("duration","-distance")
@@ -16485,6 +16515,7 @@ def virtualevent_view(request,id=0):
boatclass__in=boatclass,
sex__in=sex,
weightcategory__in=weightcategory,
adaptiveclass__in=adaptiveclass,
age__gte=age_min,
age__lte=age_max
)
@@ -16500,13 +16531,6 @@ def virtualevent_view(request,id=0):
else:
form = None
# to-do - add DNS
dns = []
if timezone.now() > race.evaluation_closure:
dns = resultobj.objects.filter(
race=race,
workoutid__isnull=True,
)
breadcrumbs = [
@@ -16606,6 +16630,7 @@ def virtualevent_addboat_view(request,id=0):
boattype = cd['boattype']
boatclass = cd['boatclass']
weightcategory = cd['weightcategory']
adaptiveclass = cd['adaptiveclass']
age = cd['age']
mix = cd['mix']
@@ -16650,6 +16675,7 @@ def virtualevent_addboat_view(request,id=0):
l = r.user.last_name
),
weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
duration=datetime.time(0,0),
boattype=boattype,
boatclass=boatclass,
@@ -16680,6 +16706,7 @@ def virtualevent_addboat_view(request,id=0):
initial = {
'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory,
'adaptiveclass': r.adaptiveclass,
}
form = VirtualRaceResultForm(initial=initial)
@@ -16763,6 +16790,7 @@ def virtualevent_register_view(request,id=0):
boattype = cd['boattype']
boatclass = cd['boatclass']
weightcategory = cd['weightcategory']
adaptiveclass = cd['adaptiveclass']
age = cd['age']
mix = cd['mix']
@@ -16786,6 +16814,7 @@ def virtualevent_register_view(request,id=0):
l = r.user.last_name
),
weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
duration=datetime.time(0,0),
boatclass=boatclass,
boattype=boattype,
@@ -16832,6 +16861,7 @@ def virtualevent_register_view(request,id=0):
initial = {
'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory,
'adaptiveclass': r.adaptiveclass,
}
form = VirtualRaceResultForm(initial=initial)
@@ -16954,6 +16984,7 @@ def indoorvirtualevent_register_view(request,id=0):
cd = form.cleaned_data
teamname = cd['teamname']
weightcategory = cd['weightcategory']
adaptiveclass = cd['adaptiveclass']
age = cd['age']
boatclass = cd['boatclass']
@@ -16975,6 +17006,7 @@ def indoorvirtualevent_register_view(request,id=0):
l = r.user.last_name
),
weightcategory=weightcategory,
adaptiveclass=adaptiveclass,
duration=datetime.time(0,0),
boatclass=boatclass,
coursecompleted=False,
@@ -17020,6 +17052,7 @@ def indoorvirtualevent_register_view(request,id=0):
initial = {
'age': calculate_age(r.birthdate),
'weightcategory': r.weightcategory,
'adaptiveclass': r.adaptiveclass,
}
form = IndoorVirtualRaceResultForm(initial=initial)