Private
Public Access
1
0

rewind to world before StandardTimes

This commit is contained in:
Sander Roosendaal
2020-05-31 12:59:02 +02:00
parent e11407b76d
commit 886ea7576c
11 changed files with 281 additions and 255 deletions

View File

@@ -12,7 +12,7 @@ from .models import (
WorkoutComment,C2WorldClassAgePerformance,PlannedSession,
GeoCourse,GeoPolygon,GeoPoint,VirtualRace,VirtualRaceResult,
PaidPlan,IndoorVirtualRaceResult,ShareKey,
CourseStandard,StandardCollection,
# CourseStandard,StandardCollection,
)
# Register your models here so you can use them in the Admin module
@@ -142,11 +142,11 @@ class IndoorVirtualRaceResultAdmin(admin.ModelAdmin):
class PaidPlanAdmin(admin.ModelAdmin):
list_display = ('name','shortname','price','paymenttype','paymentprocessor','external_id')
class StandardCollectionAdmin(admin.ModelAdmin):
list_display = ('name','manager')
#class StandardCollectionAdmin(admin.ModelAdmin):
# list_display = ('name','manager')
class CourseStandardAdmin(admin.ModelAdmin):
list_display = ('name','standardcollection')
#class CourseStandardAdmin(admin.ModelAdmin):
# list_display = ('name','standardcollection')
admin.site.unregister(User)
admin.site.register(User,UserAdmin)
@@ -167,5 +167,5 @@ admin.site.register(VirtualRaceResult, VirtualRaceResultAdmin)
admin.site.register(IndoorVirtualRaceResult, IndoorVirtualRaceResultAdmin)
admin.site.register(PaidPlan,PaidPlanAdmin)
admin.site.register(ShareKey,ShareKeyAdmin)
admin.site.register(CourseStandard,CourseStandardAdmin)
admin.site.register(StandardCollection,StandardCollectionAdmin)
#admin.site.register(CourseStandard,CourseStandardAdmin)
#admin.site.register(StandardCollection,StandardCollectionAdmin)

View File

@@ -212,18 +212,18 @@ class CourseForm(forms.Form):
from django.forms.widgets import HiddenInput
super(CourseForm, self).__init__(*args, **kwargs)
# The form used for uploading images
class StandardsForm(forms.Form):
name = forms.CharField(max_length=150,label='Course Name')
file = forms.FileField(required=False,
validators=[must_be_csv])
notes = forms.CharField(required=False,
max_length=200,label='Course Notes',
widget=forms.Textarea)
# The form used for uploading files
#class StandardsForm(forms.Form):
# name = forms.CharField(max_length=150,label='Course Name')
# file = forms.FileField(required=False,
# validators=[must_be_csv])
# notes = forms.CharField(required=False,
# max_length=200,label='Course Notes',
# widget=forms.Textarea)
def __init__(self, *args, **kwargs):
from django.forms.widgets import HiddenInput
super(StandardsForm, self).__init__(*args, **kwargs)
# def __init__(self, *args, **kwargs):
# from django.forms.widgets import HiddenInput
# super(StandardsForm, self).__init__(*args, **kwargs)
# The form used for uploading files
class DocumentsForm(forms.Form):
@@ -1230,11 +1230,11 @@ class RaceResultFilterForm(forms.Form):
initial=['None','PR1','PR2','PR3','FES'],
widget=forms.CheckboxSelectMultiple())
entrycategory = forms.MultipleChoiceField(
choices = [],
label = 'Groups',
widget=forms.CheckboxSelectMultiple()
)
# entrycategory = forms.MultipleChoiceField(
# choices = [],
# label = 'Groups',
# widget=forms.CheckboxSelectMultiple()
# )
def __init__(self, *args, **kwargs):
if 'records' in kwargs:
@@ -1244,19 +1244,18 @@ class RaceResultFilterForm(forms.Form):
if records:
# group
thecategories = [record.entrycategory for record in records]
thecategories = list(set(thecategories))
if len(thecategories) <= 1:
del self.fields['entrycategory']
else:
categorychoices = []
for category in thecategories:
if category is not None:
categorychoices.append(
(category.id,category)
)
self.fields['entrycategory'].choices = categorychoices
self.fields['entrycategory'].initial = [cat[0] for cat in categorychoices]
# thecategories = [record.entrycategory for record in records]
# thecategories = list(set(thecategories))
# if len(thecategories) <= 1:
# del self.fields['entrycategory']
# else:
# categorychoices = []
# for category in thecategories:
## categorychoices.append(
# (category.id,category)
# )
# self.fields['entrycategory'].choices = categorychoices
# self.fields['entrycategory'].initial = [cat[0] for cat in categorychoices]
# sex
thesexes = [record.sex for record in records]

View File

@@ -2183,38 +2183,38 @@ class PlannedSession(models.Model):
from django.core.validators import RegexValidator,validate_email
class StandardCollection(models.Model):
name = models.CharField(max_length=150)
manager = models.ForeignKey(User, null=True,on_delete=models.CASCADE)
notes = models.CharField(blank=True,null=True,max_length=1000)
active = models.BooleanField(default=True)
#class StandardCollection(models.Model):
# name = models.CharField(max_length=150)
# manager = models.ForeignKey(User, null=True,on_delete=models.CASCADE)
# notes = models.CharField(blank=True,null=True,max_length=1000)
# active = models.BooleanField(default=True)
def __str__(self):
return self.name
# def __str__(self):
# return self.name
class CourseStandard(models.Model):
name = models.CharField(max_length=150)
coursedistance = models.IntegerField()
coursetime = models.CharField(max_length=100,default="")
referencespeed = models.FloatField() # average boat speed
agemin = models.IntegerField(default=0)
agemax = models.IntegerField(default=120)
boatclass = models.CharField(max_length=150) # corresponds to workout workouttype
boattype = models.CharField(choices=mytypes.boattypes,max_length=50,default='1x')
sex = models.CharField(max_length=150)
weightclass = models.CharField(max_length=150)
adaptiveclass = models.CharField(choices=mytypes.adaptivetypes,max_length=50,default="None")
skillclass = models.CharField(max_length=150)
standardcollection = models.ForeignKey(StandardCollection,on_delete=models.CASCADE)
#class CourseStandard(models.Model):
# name = models.CharField(max_length=150)
# coursedistance = models.IntegerField()
# coursetime = models.CharField(max_length=100,default="")
# referencespeed = models.FloatField() # average boat speed
# agemin = models.IntegerField(default=0)
# agemax = models.IntegerField(default=120)
# boatclass = models.CharField(max_length=150) # corresponds to workout workouttype
# boattype = models.CharField(choices=mytypes.boattypes,max_length=50,default='1x')
# sex = models.CharField(max_length=150)
# weightclass = models.CharField(max_length=150)
# adaptiveclass = models.CharField(choices=mytypes.adaptivetypes,max_length=50,default="None")
# skillclass = models.CharField(max_length=150)
# standardcollection = models.ForeignKey(StandardCollection,on_delete=models.CASCADE)
class Meta:
unique_together = (
('name','standardcollection')
)
# class Meta:
# unique_together = (
# ('name','standardcollection')
# )
def __str__(self):
return self.name
# def __str__(self):
# return self.name
registerchoices = (
('windowstart','Start of challenge Window'),
@@ -2253,8 +2253,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,
verbose_name='Standard Times',blank=True)
# coursestandards = models.ForeignKey(StandardCollection,null=True,on_delete=models.SET_NULL,
# verbose_name='Standard Times',blank=True)
def __str__(self):
@@ -2424,7 +2424,7 @@ class IndoorVirtualRaceForm(ModelForm):
'registration_closure',
'evaluation_closure',
'comment',
'coursestandards',
# 'coursestandards',
'contact_phone',
'contact_email',
]
@@ -2458,7 +2458,7 @@ class IndoorVirtualRaceForm(ModelForm):
self.fields['sessionunit'].initial = 'm'
if timezone:
self.fields['timezone'].initial = timezone
self.fields['coursestandards'].queryset = StandardCollection.objects.filter(active=True)
# self.fields['coursestandards'].queryset = StandardCollection.objects.filter(active=True)
def clean(self):
cd = self.cleaned_data
@@ -2562,7 +2562,7 @@ class VirtualRaceForm(ModelForm):
'registration_closure',
'evaluation_closure',
'course',
'coursestandards',
# 'coursestandards',
'comment',
'contact_phone',
'contact_email',
@@ -2586,7 +2586,7 @@ class VirtualRaceForm(ModelForm):
def __init__(self,*args,**kwargs):
super(VirtualRaceForm, self).__init__(*args, **kwargs)
self.fields['course'].queryset = GeoCourse.objects.all().order_by("country","name")
self.fields['coursestandards'].queryset = StandardCollection.objects.filter(active=True)
# self.fields['coursestandards'].queryset = StandardCollection.objects.filter(active=True)
def clean(self):
@@ -2932,12 +2932,12 @@ class VirtualRaceResult(models.Model):
adaptiveclass = models.CharField(default="None",max_length=50,
choices=mytypes.adaptivetypes,
verbose_name="Adaptive Class")
skillclass = models.CharField(default="Open",max_length=50,
verbose_name="Skill Class")
# skillclass = models.CharField(default="Open",max_length=50,
# verbose_name="Skill Class")
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)
# points = models.IntegerField(default=0)
boatclass = models.CharField(choices=boatclasses,
max_length=40,
default='water',
@@ -2958,9 +2958,9 @@ class VirtualRaceResult(models.Model):
startsecond = models.FloatField(default=0)
endsecond = models.FloatField(default=0)
referencespeed = models.FloatField(default=5.0)
entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
verbose_name='Group')
# referencespeed = models.FloatField(default=5.0)
# entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
# verbose_name='Group')
def __str__(self):
rr = Rower.objects.get(id=self.userid)
@@ -2969,13 +2969,13 @@ class VirtualRaceResult(models.Model):
u2 = rr.user.last_name,
)
if self.teamname:
if self.entrycategory:
return u'Entry for {n} for "{r}" in {g} with {t}'.format(
n = name,
r = self.race,
g = self.entrycategory,
t = self.teamname,
)
# if self.entrycategory:
# return u'Entry for {n} for "{r}" in {g} with {t}'.format(
# n = name,
# r = self.race,
# g = self.entrycategory,
# t = self.teamname,
# )
return u'Entry for {n} for "{r}" in {c} {d} with {t} ({s})'.format(
n = name,
@@ -3015,13 +3015,13 @@ class IndoorVirtualRaceResult(models.Model):
adaptiveclass = models.CharField(default="None",max_length=50,
choices=mytypes.adaptivetypes,
verbose_name="Adaptive Class")
skillclass = models.CharField(default="Open",max_length=50,
verbose_name="Skill Class")
# skillclass = models.CharField(default="Open",max_length=50,
# verbose_name="Skill Class")
race = models.ForeignKey(VirtualRace,on_delete=models.CASCADE)
duration = models.TimeField(default=datetime.time(1,0))
distance = models.IntegerField(default=0)
referencespeed = models.FloatField(default=5.0)
points = models.IntegerField(default=0)
# points = models.IntegerField(default=0)
boatclass = models.CharField(choices=boatclasses,
max_length=40,
default='rower',
@@ -3035,8 +3035,8 @@ class IndoorVirtualRaceResult(models.Model):
age = models.IntegerField(null=True)
emailnotifications = models.BooleanField(default=True,
verbose_name = 'Receive challenge notifications by email')
entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
verbose_name='Group')
# entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
# verbose_name='Group')
def __str__(self):
rr = Rower.objects.get(id=self.userid)
@@ -3045,13 +3045,13 @@ class IndoorVirtualRaceResult(models.Model):
u2 = rr.user.last_name,
)
if self.teamname:
if self.entrycategory:
return u'Entry for {n} for "{r}" in {g} with {t}'.format(
n = name,
r = self.race,
g = self.entrycategory,
t = self.teamname,
)
# if self.entrycategory:
# return u'Entry for {n} for "{r}" in {g} with {t}'.format(
# n = name,
# r = self.race,
# g = self.entrycategory,
# t = self.teamname,
# )
return u'Entry for {n} for "{r}" on {c} with {t} ({s})'.format(
n = name,
r = self.race,
@@ -3091,13 +3091,13 @@ class IndoorVirtualRaceResultForm(ModelForm):
def __init__(self, *args, **kwargs):
categories = kwargs.pop('categories',None)
# categories = kwargs.pop('categories',None)
super(IndoorVirtualRaceResultForm, self).__init__(*args, **kwargs)
if categories is not None:
self.fields['entrycategory'].queryset = categories
self.fields['entrycategory'].empty_label = None
else:
self.fields.pop('entrycategory')
# if categories is not None:
# self.fields['entrycategory'].queryset = categories
# self.fields['entrycategory'].empty_label = None
# else:
# self.fields.pop('entrycategory')
class VirtualRaceResultForm(ModelForm):
class Meta:
@@ -3110,7 +3110,7 @@ class VirtualRaceResultForm(ModelForm):
def __init__(self, *args, **kwargs):
boattypes = kwargs.pop('boattypes',None)
categories = kwargs.pop('categories',None)
# categories = kwargs.pop('categories',None)
super(VirtualRaceResultForm, self).__init__(*args, **kwargs)
if boattypes:
@@ -3120,11 +3120,11 @@ class VirtualRaceResultForm(ModelForm):
required=False,
label='Mixed Gender')
if categories is not None:
self.fields['entrycategory'].queryset = categories
self.fields['entrycategory'].empty_label = None
else:
self.fields.pop('entrycategory')
# if categories is not None:
# self.fields['entrycategory'].queryset = categories
# self.fields['entrycategory'].empty_label = None
# else:
# self.fields.pop('entrycategory')
from rowers.metrics import rowingmetrics

View File

@@ -1514,7 +1514,6 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0):
return 0,comments,errors,0
if ws[0].workouttype != record.boatclass:
print(ws[0].workouttype,record.boatclass)
errors.append('Your workout boat class is different than on your race registration')
return 0,comments,errors,0
@@ -1553,7 +1552,8 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0):
job = myqueue(queue,handle_check_race_course,ws[0].csvfilename,
ws[0].id,race.course.id,record.id,splitsecond=splitsecond,
referencespeed=record.referencespeed,coursedistance=race.course.distance)
# referencespeed=record.referencespeed,coursedistance=race.course.distance
)

View File

@@ -1,4 +1,7 @@
from rowers.models import StandardCollection,CourseStandard, VirtualRaceResult,IndoorVirtualRaceResult
from rowers.models import (
#StandardCollection,CourseStandard,
VirtualRaceResult,IndoorVirtualRaceResult,
)
import pandas as pd
import arrow

View File

@@ -353,15 +353,15 @@ def handle_check_race_course(self,
else:
splitsecond = 0
if 'referencespeed' in kwargs:
referencespeed = kwargs['referencespeed']
else:
referencespeed = 5.0
# if 'referencespeed' in kwargs:
# referencespeed = kwargs['referencespeed']
# else:
# referencespeed = 5.0
if 'coursedistance' in kwargs:
coursedistance = kwargs['coursedistance']
else:
coursedistance = 0
# if 'coursedistance' in kwargs:
# coursedistance = kwargs['coursedistance']
# else:
# coursedistance = 0
mode = 'race'
if 'mode' in kwargs:
@@ -489,28 +489,30 @@ def handle_check_race_course(self,
else:
coursecompleted = False
points = 0
# points = 0
if coursecompleted:
if coursedistance == 0:
coursedistance = coursemeters
velo = coursedistance/coursetimeseconds
points = int(100*(2.-referencespeed/velo))
query = 'UPDATE rowers_virtualraceresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond}, points={points} WHERE id={recordid}'.format(
# if coursedistance == 0:
# coursedistance = coursemeters
# velo = coursedistance/coursetimeseconds
# points = int(100*(2.-referencespeed/velo))
# query = 'UPDATE rowers_virtualraceresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond}, points={points} WHERE id={recordid}'.format(
query = 'UPDATE rowers_virtualraceresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond} WHERE id={recordid}'.format(
recordid=recordid,
duration=totaltime_sec_to_string(coursetimeseconds),
distance=int(coursemeters),
points=points,
# points=points,
workoutid=workoutid,
startsecond=startsecond,
endsecond=endsecond,
)
if mode == 'coursetest':
query = 'UPDATE rowers_coursetestresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond}, points={points} WHERE id={recordid}'.format(
# query = 'UPDATE rowers_coursetestresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond}, points={points} WHERE id={recordid}'.format(
query = 'UPDATE rowers_coursetestresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond} WHERE id={recordid}'.format(
recordid=recordid,
duration=totaltime_sec_to_string(coursetimeseconds),
distance=int(coursemeters),
points=points,
# points=points,
workoutid=workoutid,
startsecond=startsecond,
endsecond=endsecond,

View File

@@ -133,11 +133,13 @@
</ul>
</li>
{% endif %}
{% comment %}
<li id="standards">
<a href="/rowers/list-standards/">
<i class="fas fa-award fa-fw"></i>&nbsp;Course Time Standards
</a>
</li>
{% endcomment %}
</ul> <!-- cd-accordion-menu -->
{% include 'menuscript.html' %}

View File

@@ -104,11 +104,13 @@
<th>Challenge Time Zone</th><td>{{ race.timezone }}</td>
</tr>
{% endif %}
{% comment %}
{% if race.coursestandards %}
<tr>
<th>Standard Times</th><td><a href="/rowers/standards/{{ race.coursestandards.id }}/">{{ race.coursestandards }}</a></td>
</tr>
{% endif %}
{% endcomment %}
<tr>
<th>
{{ race.sessionmode }} challenge
@@ -268,16 +270,20 @@
<th>&nbsp;</th>
<th>Name</th>
<th>Team Name</th>
{% comment %}
{% if race.coursestandards %}
<th>Group</th>
{% else %}
{% endcomment %}
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<th>Class</th>
{% if race.sessiontype == 'race' %}
<th>Boat</th>
{% comment %}
{% endif %}
{% endcomment %}
{% endif %}
<th>Time<a href="?order_by=duration">&#9660;</th>
<th>Distance<a href="?order_by=-distance">&#9660;</th>
@@ -296,9 +302,11 @@
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
{{ result.username }}</a></td>
<td>{{ result.teamname }}</td>
{% comment %}
{% if race.coursestandards %}
<td>{{ result.entrycategory }}</td>
{% else %}
{% endcomment %}
<td>{{ result.age }}</td>
<td>{{ result.sex }}</td>
<td>{{ result.weightcategory }}</td>
@@ -313,12 +321,16 @@
{% if race.sessiontype == 'race' %}
<td>{{ result.boattype }}</td>
{% endif %}
{% comment %}
{% endif %}
{% endcomment %}
<td>{{ result.duration |durationprint:"%H:%M:%S.%f" }}</td>
<td>{{ result.distance }} m</td>
{% comment %}
{% if race.coursestandards %}
<td>{{ result.points }}</td>
{% endif %}
{% endcomment %}
<td>
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
Details</a>
@@ -409,10 +421,12 @@
<tr>
<th>Name</th>
<th>Team Name</th>
{% comment %}
{% if race.coursestandards %}
<th>Group</th>
<th>Age</th>
{% else %}
{% endcomment %}
{% if race.sessiontype == 'race' %}
<th>Boat</th>
{% endif %}
@@ -421,7 +435,9 @@
<th>Gender</th>
<th>Weight Category</th>
<th>Adaptive</th>
{% comment %}
{% endif %}
{% endcomment %}
</tr>
<tbody>
{% for record in records %}
@@ -569,6 +585,7 @@
review and reject entries. If you are disqualified in this
way, you will receive an email with the reason.
</p>
{% comment %}
{% if race.coursestandards %}
<p>
Standard Times are a way to compare results in a race category with
@@ -580,6 +597,7 @@
be limited to those in the selected set of Standard Times.
</p>
{% endif %}
{% endcomment %}
</div>
</li>
</ul>

View File

@@ -35,6 +35,7 @@
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>
{% comment %}
{% if race.coursestandards %}
<p>This race uses standard times and limits the race groups to those where
standard times exist. The "Group" form choice will overrule other selections you
@@ -45,6 +46,7 @@
You can check the valid race groups and standard times <a target="_" href="/rowers/standards/{{ race.coursestandards.id }}/">here</a>.
</p>
{% endif %}
{% endcomment %}
<div class="grid_6 alpha">
<table width="100%">
{{ form.as_table }}

View File

@@ -1127,10 +1127,10 @@ def virtualevent_view(request,id=0):
except KeyError:
adaptiveclass = ['None','PR1','PR2','PR3','FES']
try:
entrycategory = cd['entrycategory']
except KeyError:
entrycategory = None
# try:
# entrycategory = cd['entrycategory']
# except KeyError:
# entrycategory = None
if race.sessiontype == 'race':
results = resultobj.objects.filter(
@@ -1156,8 +1156,8 @@ def virtualevent_view(request,id=0):
age__lte=age_max,
).order_by("duration","-distance")
if entrycategory is not None:
results = results.filter(entrycategory__in=entrycategory)
# if entrycategory is not None:
# results = results.filter(entrycategory__in=entrycategory)
# to-do - add DNS
dns = []
@@ -1479,10 +1479,10 @@ def virtualevent_addboat_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")
# categories = None
# if race.coursestandards is not None:
# categories = CourseStandard.objects.filter(
# standardcollection=race.coursestandards).order_by("name")
if not race_can_adddiscipline(r,race):
@@ -1508,7 +1508,7 @@ def virtualevent_addboat_view(request,id=0):
# we're still here
if request.method == 'POST':
# process form
form = VirtualRaceResultForm(request.POST,categories=categories)
form = VirtualRaceResultForm(request.POST) #,categories=categories)
if form.is_valid():
cd = form.cleaned_data
teamname = cd['teamname']
@@ -1530,7 +1530,7 @@ def virtualevent_addboat_view(request,id=0):
if sex == 'not specified':
sex = 'male'
if boattype in boattypes and boatclass in boatclasses and race.coursestandards is None:
if boattype in boattypes and boatclass in boatclasses: # and race.coursestandards is None:
# check if different sexes
therecords = records.filter(
boattype=boattype,
@@ -1551,47 +1551,47 @@ def virtualevent_addboat_view(request,id=0):
return HttpResponseRedirect(url)
coursestandard = None
referencespeed = 5.0
# coursestandard = None
# referencespeed = 5.0
if race.coursestandards is not None:
coursestandard = cd['entrycategory']
thegroups = [record.entrycategory for record in records]
if coursestandard in thegroups:
messages.error(request,"You have already registered in that group")
url = reverse('virtualevent_view',
kwargs = {
'id': race.id
}
)
# if race.coursestandards is not None:
# coursestandard = cd['entrycategory']
# thegroups = [record.entrycategory for record in records]
# if coursestandard in thegroups:
# messages.error(request,"You have already registered in that group")
# url = reverse('virtualevent_view',
# kwargs = {
# 'id': race.id
# }
# )
return HttpResponseRedirect(url)
# return HttpResponseRedirect(url)
referencespeed = coursestandard.referencespeed
boattype = coursestandard.boattype
boatclass = coursestandard.boatclass
weightcategory = coursestandard.weightclass
adaptiveclass = coursestandard.adaptiveclass
skillclass = coursestandard.skillclass
# referencespeed = coursestandard.referencespeed
# boattype = coursestandard.boattype
# boatclass = coursestandard.boatclass
# weightcategory = coursestandard.weightclass
# adaptiveclass = coursestandard.adaptiveclass
# skillclass = coursestandard.skillclass
returnurl = reverse(virtualevent_register_view,
kwargs={'id':race.id})
# returnurl = reverse(virtualevent_register_view,
# kwargs={'id':race.id})
if age < coursestandard.agemin:
messages.error(request,'You are younger than the minimum age for this group')
return HttpResponseRedirect(returnurl)
# if age < coursestandard.agemin:
# messages.error(request,'You are younger than the minimum age for this group')
# return HttpResponseRedirect(returnurl)
if age > coursestandard.agemax:
messages.error(request,'You are older than the maximum age for this group')
return HttpResponseRedirect(returnurl)
# if age > coursestandard.agemax:
# messages.error(request,'You are older than the maximum age for this group')
# return HttpResponseRedirect(returnurl)
if sex == 'male' and coursestandard.sex != 'male':
messages.error(request,'Men are not allowed to enter this category')
return HttpResponseRedirect(returnurl)
# if sex == 'male' and coursestandard.sex != 'male':
# messages.error(request,'Men are not allowed to enter this category')
# 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(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(returnurl)
record = VirtualRaceResult(
@@ -1608,8 +1608,8 @@ def virtualevent_addboat_view(request,id=0):
boattype=boattype,
boatclass=boatclass,
coursecompleted=False,
referencespeed=referencespeed,
entrycategory=coursestandard,
# referencespeed=referencespeed,
# entrycategory=coursestandard,
sex=sex,
age=age,
)
@@ -1639,13 +1639,13 @@ def virtualevent_addboat_view(request,id=0):
'adaptiveclass': r.adaptiveclass,
}
categories = None
if race.coursestandards is not None:
categories = CourseStandard.objects.filter(
standardcollection=race.coursestandards).order_by("name")
# categories = None
# if race.coursestandards is not None:
# categories = CourseStandard.objects.filter(
# standardcollection=race.coursestandards).order_by("name")
form = VirtualRaceResultForm(initial=initial,categories=categories)
form = VirtualRaceResultForm(initial=initial) #,categories=categories)
breadcrumbs = [
{
@@ -1706,10 +1706,10 @@ 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")
# 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")
@@ -1724,7 +1724,7 @@ def virtualevent_register_view(request,id=0):
# we're still here
if request.method == 'POST':
# process form
form = VirtualRaceResultForm(request.POST,categories=categories)
form = VirtualRaceResultForm(request.POST) #,categories=categories)
if form.is_valid():
cd = form.cleaned_data
teamname = cd['teamname']
@@ -1747,36 +1747,36 @@ def virtualevent_register_view(request,id=0):
sex = 'male'
coursestandard = None
referencespeed = 5.0
# coursestandard = None
# referencespeed = 5.0
if race.coursestandards is not None:
coursestandard = cd['entrycategory']
referencespeed = coursestandard.referencespeed
boattype = coursestandard.boattype
boatclass = coursestandard.boatclass
weightcategory = coursestandard.weightclass
adaptiveclass = coursestandard.adaptiveclass
skillclass = coursestandard.skillclass
# if race.coursestandards is not None:
# coursestandard = cd['entrycategory']
# referencespeed = coursestandard.referencespeed
# boattype = coursestandard.boattype
# boatclass = coursestandard.boatclass
# weightcategory = coursestandard.weightclass
# adaptiveclass = coursestandard.adaptiveclass
# skillclass = coursestandard.skillclass
returnurl = reverse(virtualevent_register_view,
kwargs={'id':race.id})
# returnurl = reverse(virtualevent_register_view,
# kwargs={'id':race.id})
if age < coursestandard.agemin:
messages.error(request,'You are younger than the minimum age for this group')
return HttpResponseRedirect(returnurl)
# if age < coursestandard.agemin:
# messages.error(request,'You are younger than the minimum age for this group')
# return HttpResponseRedirect(returnurl)
if age > coursestandard.agemax:
messages.error(request,'You are older than the maximum age for this group')
return HttpResponseRedirect(returnurl)
# if age > coursestandard.agemax:
# messages.error(request,'You are older than the maximum age for this group')
# return HttpResponseRedirect(returnurl)
if sex == 'male' and coursestandard.sex != 'male':
messages.error(request,'Men are not allowed to enter this category')
return HttpResponseRedirect(returnurl)
# if sex == 'male' and coursestandard.sex != 'male':
# messages.error(request,'Men are not allowed to enter this category')
# 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(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(returnurl)
@@ -1796,8 +1796,8 @@ def virtualevent_register_view(request,id=0):
coursecompleted=False,
sex=sex,
age=age,
entrycategory=coursestandard,
referencespeed=referencespeed,
# entrycategory=coursestandard,
# referencespeed=referencespeed,
)
record.save()
@@ -1841,12 +1841,12 @@ def virtualevent_register_view(request,id=0):
'adaptiveclass': r.adaptiveclass,
}
categories = None
if race.coursestandards is not None:
categories = CourseStandard.objects.filter(
standardcollection=race.coursestandards).order_by("name")
# categories = None
# if race.coursestandards is not None:
# categories = CourseStandard.objects.filter(
# standardcollection=race.coursestandards).order_by("name")
form = VirtualRaceResultForm(initial=initial,categories=categories)
form = VirtualRaceResultForm(initial=initial) #,categories=categories)
breadcrumbs = [
{
@@ -1948,10 +1948,10 @@ def indoorvirtualevent_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")
# 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")
@@ -1966,7 +1966,7 @@ def indoorvirtualevent_register_view(request,id=0):
# we're still here
if request.method == 'POST':
# process form
form = IndoorVirtualRaceResultForm(request.POST,categories=categories)
form = IndoorVirtualRaceResultForm(request.POST) #,categories=categories)
if form.is_valid():
cd = form.cleaned_data
teamname = cd['teamname']
@@ -1984,35 +1984,35 @@ def indoorvirtualevent_register_view(request,id=0):
if sex == 'not specified':
sex = 'male'
coursestandard = None
referencespeed = 5.0
# coursestandard = None
# referencespeed = 5.0
if race.coursestandards is not None:
coursestandard = cd['entrycategory']
referencespeed = coursestandard.referencespeed
boatclass = coursestandard.boatclass
weightcategory = coursestandard.weightclass
adaptiveclass = coursestandard.adaptiveclass
skillclass = coursestandard.skillclass
# if race.coursestandards is not None:
# coursestandard = cd['entrycategory']
# referencespeed = coursestandard.referencespeed
# boatclass = coursestandard.boatclass
# weightcategory = coursestandard.weightclass
# adaptiveclass = coursestandard.adaptiveclass
# skillclass = coursestandard.skillclass
returnurl = reverse(virtualevent_register_view,
kwargs={'id':race.id})
# returnurl = reverse(virtualevent_register_view,
# kwargs={'id':race.id})
if age < coursestandard.agemin:
messages.error(request,'You are younger than the minimum age for this group')
return HttpResponseRedirect(returnurl)
# if age < coursestandard.agemin:
# messages.error(request,'You are younger than the minimum age for this group')
# return HttpResponseRedirect(returnurl)
if age > coursestandard.agemax:
messages.error(request,'You are older than the maximum age for this group')
return HttpResponseRedirect(returnurl)
# if age > coursestandard.agemax:
# messages.error(request,'You are older than the maximum age for this group')
# return HttpResponseRedirect(returnurl)
if sex == 'male' and coursestandard.sex != 'male':
messages.error(request,'Men are not allowed to enter this category')
return HttpResponseRedirect(returnurl)
# if sex == 'male' and coursestandard.sex != 'male':
# messages.error(request,'Men are not allowed to enter this category')
# 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(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(returnurl)
@@ -2031,8 +2031,8 @@ def indoorvirtualevent_register_view(request,id=0):
coursecompleted=False,
sex=sex,
age=age,
entrycategory=coursestandard,
referencespeed=referencespeed
# entrycategory=coursestandard,
# referencespeed=referencespeed
)
record.save()
@@ -2076,12 +2076,12 @@ def indoorvirtualevent_register_view(request,id=0):
'adaptiveclass': r.adaptiveclass,
}
categories = None
if race.coursestandards is not None:
categories = CourseStandard.objects.filter(
standardcollection=race.coursestandards).order_by("name")
# categories = None
# if race.coursestandards is not None:
# categories = CourseStandard.objects.filter(
# standardcollection=race.coursestandards).order_by("name")
form = IndoorVirtualRaceResultForm(initial=initial,categories=categories)
form = IndoorVirtualRaceResultForm(initial=initial) #,categories=categories)
breadcrumbs = [
{
@@ -2154,7 +2154,7 @@ def indoorvirtualevent_create_view(request):
evaluation_closure = cd['evaluation_closure']
contact_phone = cd['contact_phone']
contact_email = cd['contact_email']
coursestandards = cd['coursestandards']
# coursestandards = cd['coursestandards']
# correct times
@@ -2209,7 +2209,7 @@ def indoorvirtualevent_create_view(request):
sessionvalue = sessionvalue,
course=None,
timezone=timezone_str,
coursestandards=coursestandards,
# coursestandards=coursestandards,
evaluation_closure=evaluation_closure,
registration_closure=registration_closure,
contact_phone=contact_phone,
@@ -2296,7 +2296,7 @@ def virtualevent_create_view(request):
evaluation_closure = cd['evaluation_closure']
contact_phone = cd['contact_phone']
contact_email = cd['contact_email']
coursestandards = cd['coursestandards']
# coursestandards = cd['coursestandards']
# correct times
@@ -2348,7 +2348,7 @@ def virtualevent_create_view(request):
evaluation_closure=evaluation_closure,
registration_closure=registration_closure,
contact_phone=contact_phone,
coursestandards=coursestandards,
# coursestandards=coursestandards,
contact_email=contact_email,
country = course.country,
manager=request.user,

View File

@@ -94,7 +94,7 @@ from rowers.forms import (
EmailForm, RegistrationForm, RegistrationFormTermsOfService,
RegistrationFormUniqueEmail,RegistrationFormSex,
CNsummaryForm,UpdateWindForm,
StandardsForm,
# StandardsForm,
UpdateStreamForm,WorkoutMultipleCompareForm,ChartParamChoiceForm,
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
TrendFlexModalForm,WorkoutSplitForm,WorkoutJoinParamForm,
@@ -115,7 +115,7 @@ from rowers.models import (
AlertEditForm, ConditionEditForm,
PlannedSessionComment,CoachRequest,CoachOffer,
VideoAnalysis,ShareKey,
StandardCollection,CourseStandard,
# StandardCollection,CourseStandard,
)
from rowers.models import (
RowerPowerForm,RowerForm,GraphImage,AdvancedWorkoutForm,