some refinements
This commit is contained in:
@@ -66,16 +66,28 @@ def save_scoring(name,user,filename,id=0,notes=""):
|
||||
|
||||
try:
|
||||
sex = row['Gender']
|
||||
if sex.lower() in ['m','men','male','open']:
|
||||
sex = 'male'
|
||||
elif sex.lower() in ['mix','mixed']:
|
||||
sex = 'mixed'
|
||||
else:
|
||||
sex = 'female'
|
||||
except KeyError:
|
||||
sex = 'F'
|
||||
sex = 'female'
|
||||
|
||||
try:
|
||||
weightclass = row['WeightClass']
|
||||
if weightclass.lower() in ['hwt','h','o','heavy','open']:
|
||||
weightclass = 'hwt'
|
||||
elif weightclass.lower() in ['lwt','l','light','lights','lighties']:
|
||||
weightclass = 'lwt'
|
||||
except KeyError:
|
||||
weightclass = 'hwt'
|
||||
|
||||
try:
|
||||
adaptiveclass = row['AdaptiveClass']
|
||||
if adaptiveclass.lower() in ['o','open','none','no']:
|
||||
adaptiveclass = None
|
||||
except KeyError:
|
||||
adaptiveclass = None
|
||||
|
||||
|
||||
@@ -36,11 +36,14 @@
|
||||
mixed gender crew (except for 1x where this check box does nothing).
|
||||
</p>
|
||||
{% if race.coursestandards %}
|
||||
<p>This race uses standard times and limits the race fields to those where
|
||||
<p>This race uses standard times and limits the race groups to those where
|
||||
standard times exist. The "Field" form choice will overrule other selections you
|
||||
make in the form (boat type, weight, etc) and your entry will be rejected
|
||||
if the age and gender doesn't match.
|
||||
</p>
|
||||
<p>
|
||||
You can check the valid race groups and standard times <a target="_" href="/rowers/standards/{{ race.coursestandards.id }}/">here</a>.
|
||||
</p>
|
||||
{% endif %}
|
||||
<div class="grid_6 alpha">
|
||||
<table width="100%">
|
||||
|
||||
@@ -292,11 +292,11 @@ def standard_view(request,id=0):
|
||||
if orderby is not None:
|
||||
standards = CourseStandard.objects.filter(
|
||||
standardcollection=collection
|
||||
).order_by(orderby,"-coursestandard","agemax","agemin","sex","name")
|
||||
).order_by(orderby,"-referencespeed","agemax","agemin","sex","name")
|
||||
else:
|
||||
standards = CourseStandard.objects.filter(
|
||||
standardcollection=collection
|
||||
).order_by("-coursestandard","agemax","agemin","sex","name")
|
||||
).order_by("-referencespeed","agemax","agemin","sex","name")
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
@@ -1596,6 +1596,11 @@ def virtualevent_register_view(request,id=0):
|
||||
except VirtualRace.DoesNotExist:
|
||||
raise Http404("Virtual Challenge does not exist")
|
||||
|
||||
categories = None
|
||||
if race.coursestandards is not None:
|
||||
categories = CourseStandard.objects.filter(
|
||||
standardcollection=race.coursestandards).order_by("name")
|
||||
|
||||
if not race_can_register(r,race):
|
||||
messages.error(request,"You cannot register for this race")
|
||||
|
||||
@@ -1609,7 +1614,7 @@ def virtualevent_register_view(request,id=0):
|
||||
# we're still here
|
||||
if request.method == 'POST':
|
||||
# process form
|
||||
form = VirtualRaceResultForm(request.POST)
|
||||
form = VirtualRaceResultForm(request.POST,categories=categories)
|
||||
if form.is_valid():
|
||||
cd = form.cleaned_data
|
||||
teamname = cd['teamname']
|
||||
@@ -1640,7 +1645,7 @@ def virtualevent_register_view(request,id=0):
|
||||
referencespeed = coursestandard.referencespeed
|
||||
boattype = coursestandard.boattype
|
||||
boatclass = coursestandard.boatclass
|
||||
weightcategory = coursestandard.weightcategory
|
||||
weightcategory = coursestandard.weightclass
|
||||
adaptiveclass = coursestandard.adaptiveclass
|
||||
skillclass = coursestandard.skillclass
|
||||
|
||||
@@ -1649,19 +1654,19 @@ def virtualevent_register_view(request,id=0):
|
||||
|
||||
if age < coursestandard.agemin:
|
||||
messages.error(request,'You are younger than the minimum age for this group')
|
||||
return HttpResponseRedirect(url)
|
||||
return HttpResponseRedirect(returnurl)
|
||||
|
||||
if age > coursestandard.agemax:
|
||||
messages.error(request,'You are older than the maximum age for this group')
|
||||
return HttpResponseRedirect(url)
|
||||
return HttpResponseRedirect(returnurl)
|
||||
|
||||
if sex == 'male' and coursestandard.sex != 'male':
|
||||
messages.error(request,'Men are not allowed to enter this category')
|
||||
return HttpResponseRedirect(url)
|
||||
return HttpResponseRedirect(returnurl)
|
||||
|
||||
if sex == 'mixed' and coursestandard.sex not in ['mixed','male']:
|
||||
messages.error(request,'Mixed crews are not allowed to enter this category')
|
||||
return HttpResponseRedirect(url)
|
||||
return HttpResponseRedirect(returnurl)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user