Private
Public Access
1
0

adding Standard Times to events

This commit is contained in:
Sander Roosendaal
2020-05-26 20:55:50 +02:00
parent 16ca9da117
commit 66454b9ba2
6 changed files with 56 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
# Generated by Django 2.1.7 on 2020-05-26 18:13
# Generated by Django 2.1.7 on 2020-05-26 18:20
import datetime
from django.conf import settings

View File

@@ -2262,7 +2262,8 @@ class VirtualRace(PlannedSession):
contact_email = models.EmailField(max_length=254,
validators=[validate_email],blank=True)
coursestandards = models.ForeignKey(StandardCollection,null=True,on_delete=models.SET_NULL)
coursestandards = models.ForeignKey(StandardCollection,null=True,on_delete=models.SET_NULL,
verbose_name='Standard Times')
def __str__(self):
@@ -2432,6 +2433,7 @@ class IndoorVirtualRaceForm(ModelForm):
'registration_closure',
'evaluation_closure',
'comment',
'coursestandards',
'contact_phone',
'contact_email',
]
@@ -2568,6 +2570,7 @@ class VirtualRaceForm(ModelForm):
'registration_closure',
'evaluation_closure',
'course',
'coursestandards',
'comment',
'contact_phone',
'contact_email',
@@ -2939,6 +2942,7 @@ class VirtualRaceResult(models.Model):
race = models.ForeignKey(VirtualRace,on_delete=models.CASCADE)
duration = models.TimeField(default=datetime.time(1,0))
distance = models.IntegerField(default=0)
points = models.IntegerField(default=0)
boatclass = models.CharField(choices=boatclasses,
max_length=40,
default='water',
@@ -3002,6 +3006,7 @@ class IndoorVirtualRaceResult(models.Model):
race = models.ForeignKey(VirtualRace,on_delete=models.CASCADE)
duration = models.TimeField(default=datetime.time(1,0))
distance = models.IntegerField(default=0)
points = models.IntegerField(default=0)
boatclass = models.CharField(choices=boatclasses,
max_length=40,
default='rower',

View File

@@ -55,6 +55,15 @@
If you require a screenshot of the PM monitor, do mention this
in the comment.
</p>
<p>
Standard Times are a way to compare results in a race category with
a course record or golden standard for that event. A point score is calculated
which compares the participant's result with the standard. This offers an
engaging way to compete on points across different categories, boat types, and skill
levels.
If you select a Standard Times set from the drop-down list, race categories will
be limited to those in the selected set of Standard Times.
</p>
</ul>
</p>
</li>

View File

@@ -104,6 +104,11 @@
<th>Challenge Time Zone</th><td>{{ race.timezone }}</td>
</tr>
{% endif %}
{% if race.coursestandards %}
<tr>
<th>Standard Times</th><td><a href="/rowers/standards/{{ race.coursestandards.id }}/">{{ race.coursestandards }}</a></td>
</tr>
{% endif %}
<tr>
<th>
{{ race.sessionmode }} challenge
@@ -541,6 +546,17 @@
review and reject entries. If you are disqualified in this
way, you will receive an email with the reason.
</p>
{% if race.coursestandards %}
<p>
Standard Times are a way to compare results in a race category with
a course record or golden standard for that event. A point score is calculated
which compares the participant's result with the standard. This offers an
engaging way to compete on points across different categories, boat types, and skill
levels.
If you select a Standard Times set from the drop-down list, race categories will
be limited to those in the selected set of Standard Times.
</p>
{% endif %}
</div>
</li>
</ul>

View File

@@ -49,6 +49,15 @@
is strongly recommended that you fill out a contact email or phone
number.
</p>
<p>
Standard Times are a way to compare results in a race category with
a course record or golden standard for that event. A point score is calculated
which compares the participant's result with the standard. This offers an
engaging way to compete on points across different categories, boat types, and skill
levels.
If you select a Standard Times set from the drop-down list, race categories will
be limited to those in the selected set of Standard Times.
</p>
</li>
</ul>

View File

@@ -529,6 +529,11 @@ def standards_upload_view(request,id=0):
is_ajax = True
r = getrower(request.user)
if id != 0:
collection = StandardCollection.objects.get(id=id)
if request.user != collection.manager:
raise PermissionDenied("You cannot change this set of time standards")
if request.method == 'POST':
form = StandardsForm(request.POST,request.FILES)
@@ -573,6 +578,12 @@ def standards_upload_view(request,id=0):
else:
if not is_ajax:
form = StandardsForm()
if id != 0:
collection = StandardCollection.objects.get(id=id)
form = StandardsForm(initial={
'name':collection.name,
'notes': collection.notes,
})
return render(request,'standard_form.html',
{'form':form,
'active':'nav-racing',
@@ -655,7 +666,6 @@ def virtualevents_view(request):
country__in=countries
).order_by("startdate","start_time")
else:
form = VirtualRaceSelectForm()
if is_ajax:
@@ -1938,6 +1948,7 @@ def indoorvirtualevent_create_view(request):
evaluation_closure = cd['evaluation_closure']
contact_phone = cd['contact_phone']
contact_email = cd['contact_email']
coursestandards = cd['coursestandards']
# correct times
@@ -1992,6 +2003,7 @@ def indoorvirtualevent_create_view(request):
sessionvalue = sessionvalue,
course=None,
timezone=timezone_str,
coursestandards=coursestandards,
evaluation_closure=evaluation_closure,
registration_closure=registration_closure,
contact_phone=contact_phone,
@@ -2078,6 +2090,7 @@ def virtualevent_create_view(request):
evaluation_closure = cd['evaluation_closure']
contact_phone = cd['contact_phone']
contact_email = cd['contact_email']
coursestandards = cd['coursestandards']
# correct times
@@ -2129,6 +2142,7 @@ def virtualevent_create_view(request):
evaluation_closure=evaluation_closure,
registration_closure=registration_closure,
contact_phone=contact_phone,
coursestandards=coursestandards,
contact_email=contact_email,
country = course.country,
manager=request.user,