Private
Public Access
1
0

added mixed as category

This commit is contained in:
Sander Roosendaal
2018-06-01 20:11:16 +02:00
parent 6b713cb91f
commit 0a259d51e1
4 changed files with 35 additions and 2 deletions

View File

@@ -1645,6 +1645,10 @@ class VirtualRaceResultForm(ModelForm):
if boattypes: if boattypes:
self.fields['boattype'].choices = boattypes self.fields['boattype'].choices = boattypes
self.fields['mix'] = forms.BooleanField(initial=False,
required=False,
label='Mixed Gender')
from rowers.metrics import rowingmetrics from rowers.metrics import rowingmetrics

View File

@@ -160,6 +160,7 @@
<th>Team Name</th> <th>Team Name</th>
<th>Boat</th> <th>Boat</th>
<th>Age</th> <th>Age</th>
<th>Gender</th>
<th>Weight Category</th> <th>Weight Category</th>
</tr> </tr>
<tbody> <tbody>
@@ -169,6 +170,7 @@
<td>{{ record.teamname }}</td> <td>{{ record.teamname }}</td>
<td>{{ record.boattype }}</td> <td>{{ record.boattype }}</td>
<td>{{ record.age }}</td> <td>{{ record.age }}</td>
<td>{{ record.sex }}</td>
<td>{{ record.weightcategory }}</td> <td>{{ record.weightcategory }}</td>
{% if record.userid == rower.id and 'withdrawbutton' in buttons %} {% if record.userid == rower.id and 'withdrawbutton' in buttons %}
<td> <td>

View File

@@ -31,6 +31,13 @@
value from your user settings. For other boat types, please fill out value from your user settings. For other boat types, please fill out
crew weight class and average age. crew weight class and average age.
</p> </p>
<p>
You will register as a crew with the gender of your user settings. If
your user settings have gender "not specified", you will be registered
as a Male crew. Check the "Mixed gender" check box to register as a
mixed gender crew (except for 1x where this check box does nothing).
</p>
<div class="grid_6 alpha"> <div class="grid_6 alpha">
<table width="100%"> <table width="100%">
{{ form.as_table }} {{ form.as_table }}

View File

@@ -13558,9 +13558,19 @@ def virtualevent_addboat_view(request,id=0):
boattype = cd['boattype'] boattype = cd['boattype']
weightcategory = cd['weightcategory'] weightcategory = cd['weightcategory']
age = cd['age'] age = cd['age']
mix = cd['mix']
sex = r.sex
if mix:
sex = 'mixed'
if boattype == '1x' and r.birthdate: if boattype == '1x' and r.birthdate:
age = calculate_age(r.birthdate) age = calculate_age(r.birthdate)
sex = r.sex
if sex == 'not specified':
sex = 'male'
if boattype in boattypes: if boattype in boattypes:
messages.error(request,"You have already registered in that boat type") messages.error(request,"You have already registered in that boat type")
url = reverse(virtualevent_view, url = reverse(virtualevent_view,
@@ -13583,7 +13593,7 @@ def virtualevent_addboat_view(request,id=0):
duration=datetime.time(0,0), duration=datetime.time(0,0),
boattype=boattype, boattype=boattype,
coursecompleted=False, coursecompleted=False,
sex=r.sex, sex=sex,
age=age age=age
) )
@@ -13649,8 +13659,18 @@ def virtualevent_register_view(request,id=0):
boattype = cd['boattype'] boattype = cd['boattype']
weightcategory = cd['weightcategory'] weightcategory = cd['weightcategory']
age = cd['age'] age = cd['age']
mix = cd['mix']
sex = r.sex
if mix:
sex = 'mixed'
if boattype == '1x' and r.birthdate: if boattype == '1x' and r.birthdate:
age = calculate_age(r.birthdate) age = calculate_age(r.birthdate)
sex = r.sex
if sex == 'not specified':
sex = 'male'
record = VirtualRaceResult( record = VirtualRaceResult(
userid=r.id, userid=r.id,
@@ -13664,7 +13684,7 @@ def virtualevent_register_view(request,id=0):
duration=datetime.time(0,0), duration=datetime.time(0,0),
boattype=boattype, boattype=boattype,
coursecompleted=False, coursecompleted=False,
sex=r.sex, sex=sex,
age=age age=age
) )