Private
Public Access
1
0

first result working

This commit is contained in:
Sander Roosendaal
2020-05-27 14:56:09 +02:00
parent 8bfbb2bdf8
commit 2ba9133a1d
9 changed files with 112 additions and 45 deletions

View File

@@ -2252,7 +2252,7 @@ class VirtualRace(PlannedSession):
validators=[validate_email],blank=True) 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') verbose_name='Standard Times',blank=True)
def __str__(self): def __str__(self):
@@ -2954,6 +2954,7 @@ class VirtualRaceResult(models.Model):
startsecond = models.FloatField(default=0) startsecond = models.FloatField(default=0)
endsecond = 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, entrycategory = models.ForeignKey(CourseStandard,null=True,on_delete=models.SET_NULL,
verbose_name='Group') verbose_name='Group')

View File

@@ -1514,6 +1514,7 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0):
return 0,comments,errors,0 return 0,comments,errors,0
if ws[0].workouttype != record.boatclass: 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') errors.append('Your workout boat class is different than on your race registration')
return 0,comments,errors,0 return 0,comments,errors,0
@@ -1551,7 +1552,8 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0):
comments.append('Workouts submitted to virtual events have to be public. We have changed the workout to a public workout.') comments.append('Workouts submitted to virtual events have to be public. We have changed the workout to a public workout.')
job = myqueue(queue,handle_check_race_course,ws[0].csvfilename, job = myqueue(queue,handle_check_race_course,ws[0].csvfilename,
ws[0].id,race.course.id,record.id,splitsecond=splitsecond) ws[0].id,race.course.id,record.id,splitsecond=splitsecond,
referencespeed=record.referencespeed)

View File

@@ -17,6 +17,10 @@ def save_scoring(name,user,filename,id=0,notes=""):
collection.name = name collection.name = name
collection.notes = notes collection.notes = notes
collection.save() collection.save()
standards = CourseStandard.objects.filter(standardcollection=collection)
for standard in standards:
print(standard,collection)
standard.delete()
except StandardCollection.DoesNotExist: except StandardCollection.DoesNotExist:
return 0 return 0
@@ -56,6 +60,20 @@ def save_scoring(name,user,filename,id=0,notes=""):
try: try:
boatclass = row['BoatClass'] boatclass = row['BoatClass']
if boatclass.lower() in ['standard','olympic','normal']:
boatclass = 'water'
elif boatclass.lower() in ['erg','c2','concept','static']:
boatclass = 'rower'
elif boatclass.lower() in ['dynamic']:
boatclass = 'dynamic'
elif boatclass.lower() in ['slides','slide','slider','sliders']:
boatclass = 'slides'
elif boatclass.lower() in ['c','c-boat']:
boatclass = 'c-boat'
elif boatclass.lower() in ['coastal','coast']:
boatclass = 'coastal'
elif boatclass.lower() in ['church','churchboat','finnish','finland']:
boatclass = 'churchboat'
except KeyError: except KeyError:
boatclass = 'water' boatclass = 'water'

View File

@@ -353,6 +353,16 @@ def handle_check_race_course(self,
else: else:
splitsecond = 0 splitsecond = 0
if 'referencespeed' in kwargs:
referencespeed = kwargs['referencespeed']
else:
referencespeed = 5.0
if 'coursedistance' in kwargs:
coursedistance = kwargs['coursedistance']
else:
coursedistance = 0
mode = 'race' mode = 'race'
if 'mode' in kwargs: if 'mode' in kwargs:
mode = kwargs['mode'] mode = kwargs['mode']
@@ -479,22 +489,28 @@ def handle_check_race_course(self,
else: else:
coursecompleted = False coursecompleted = False
points = 0
if coursecompleted: if coursecompleted:
query = 'UPDATE rowers_virtualraceresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond} 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(
recordid=recordid, recordid=recordid,
duration=totaltime_sec_to_string(coursetimeseconds), duration=totaltime_sec_to_string(coursetimeseconds),
distance=int(coursemeters), distance=int(coursemeters),
points=points,
workoutid=workoutid, workoutid=workoutid,
startsecond=startsecond, startsecond=startsecond,
endsecond=endsecond, endsecond=endsecond,
) )
if mode == 'coursetest': if mode == 'coursetest':
query = 'UPDATE rowers_coursetestresult SET coursecompleted = 1, duration = "{duration}", distance = {distance}, workoutid = {workoutid}, startsecond = {startsecond}, endsecond = {endsecond} 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(
recordid=recordid, recordid=recordid,
duration=totaltime_sec_to_string(coursetimeseconds), duration=totaltime_sec_to_string(coursetimeseconds),
distance=int(coursemeters), distance=int(coursemeters),
points=points,
workoutid=workoutid, workoutid=workoutid,
startsecond=startsecond, startsecond=startsecond,
endsecond=endsecond, endsecond=endsecond,

View File

@@ -187,7 +187,7 @@
$.ajax({ $.ajax({
data: data, data: data,
type: $(this).attr('method'), type: $(this).attr('method'),
url: '/rowers/standards/upload/', url: window.location.pathname,
contentType: false, contentType: false,
processData: false, processData: false,
error: function(result) { error: function(result) {

View File

@@ -268,7 +268,9 @@
<th>&nbsp;</th> <th>&nbsp;</th>
<th>Name</th> <th>Name</th>
<th>Team Name</th> <th>Team Name</th>
<th>&nbsp;</th> {% if race.coursestandards %}
<th>Group</th>
{% else %}
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th>&nbsp;</th> <th>&nbsp;</th>
@@ -276,8 +278,12 @@
{% if race.sessiontype == 'race' %} {% if race.sessiontype == 'race' %}
<th>Boat</th> <th>Boat</th>
{% endif %} {% endif %}
{% endif %}
<th>Time</th> <th>Time</th>
<th>Distance</th> <th>Distance</th>
{% if race.coursestandards %}
<th>Points</th>
{% endif %}
<th>Details</th> <th>Details</th>
<th>&nbsp;</th> <th>&nbsp;</th>
</tr> </tr>
@@ -290,6 +296,9 @@
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/"> <a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
{{ result.username }}</a></td> {{ result.username }}</a></td>
<td>{{ result.teamname }}</td> <td>{{ result.teamname }}</td>
{% if race.coursestandards %}
<td>{{ result.entrycategory }}</td>
{% else %}
<td>{{ result.age }}</td> <td>{{ result.age }}</td>
<td>{{ result.sex }}</td> <td>{{ result.sex }}</td>
<td>{{ result.weightcategory }}</td> <td>{{ result.weightcategory }}</td>
@@ -304,11 +313,17 @@
{% if race.sessiontype == 'race' %} {% if race.sessiontype == 'race' %}
<td>{{ result.boattype }}</td> <td>{{ result.boattype }}</td>
{% endif %} {% endif %}
{% endif %}
<td>{{ result.duration |durationprint:"%H:%M:%S.%f" }}</td> <td>{{ result.duration |durationprint:"%H:%M:%S.%f" }}</td>
<td>{{ result.distance }} m</td> <td>{{ result.distance }} m</td>
{% if race.coursestandards %}
<td>{{ result.points }}</td>
{% endif %}
<td> <td>
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/"> <a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
Details</a></td> Details</a>
</td>
<td> <td>
{% if race.manager == request.user and not race|is_final %} {% if race.manager == request.user and not race|is_final %}
<a href="/rowers/virtualevent/{{ race.id }}/disqualify/{{ result.id }}/"> <a href="/rowers/virtualevent/{{ race.id }}/disqualify/{{ result.id }}/">
@@ -394,22 +409,29 @@
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Team Name</th> <th>Team Name</th>
{% if race.sessiontype == 'race' %} {% if race.coursestandards %}
<th>Class</th> <th>Group</th>
<th>Boat</th> <th>Age</th>
{% else %} {% else %}
<th>Class</th> {% if race.sessiontype == 'race' %}
<th>Boat</th>
{% endif %} {% endif %}
<th>Class</th>
<th>Age</th> <th>Age</th>
<th>Gender</th> <th>Gender</th>
<th>Weight Category</th> <th>Weight Category</th>
<th>Adaptive</th> <th>Adaptive</th>
{% endif %}
</tr> </tr>
<tbody> <tbody>
{% for record in records %} {% for record in records %}
<tr> <tr>
<td>{{ record.username }} <td>{{ record.username }}
<td>{{ record.teamname }}</td> <td>{{ record.teamname }}</td>
{% if race.coursestandards %}
<td>{{ record.entrycategory }}</td>
<td>{{ record.age }}</td>
{% else %}
<td>{{ record.boatclass }}</td> <td>{{ record.boatclass }}</td>
{% if race.sessiontype == 'race' %} {% if race.sessiontype == 'race' %}
<td>{{ record.boattype }}</td> <td>{{ record.boattype }}</td>
@@ -424,6 +446,7 @@
{{ record.adaptiveclass }} {{ record.adaptiveclass }}
{% endif %} {% endif %}
</td> </td>
{% endif %}
{% if record.userid == rower.id and 'withdrawbutton' in buttons %} {% if record.userid == rower.id and 'withdrawbutton' in buttons %}
<td> <td>
<a href="/rowers/virtualevent/{{ race.id }}/withdraw/{{ record.id }}" >Withdraw</a> <a href="/rowers/virtualevent/{{ race.id }}/withdraw/{{ record.id }}" >Withdraw</a>

View File

@@ -525,6 +525,7 @@ def course_upload_view(request):
@login_required() @login_required()
def standards_upload_view(request,id=0): def standards_upload_view(request,id=0):
is_ajax = False is_ajax = False
print(id,'aap')
if request.is_ajax(): if request.is_ajax():
is_ajax = True is_ajax = True
r = getrower(request.user) r = getrower(request.user)
@@ -573,6 +574,8 @@ def standards_upload_view(request,id=0):
messages.error(request,'Form is not valid') messages.error(request,'Form is not valid')
return render(request,'standard_form.html', return render(request,'standard_form.html',
{'form':form, {'form':form,
'active':'nav-racing',
'id':id,
}) })
else: else:
@@ -587,6 +590,7 @@ def standards_upload_view(request,id=0):
return render(request,'standard_form.html', return render(request,'standard_form.html',
{'form':form, {'form':form,
'active':'nav-racing', 'active':'nav-racing',
'id':id,
}) })
return {'result':0} return {'result':0}
@@ -1127,8 +1131,6 @@ def virtualevent_view(request,id=0):
else: else:
form = None form = None
breadcrumbs = [ breadcrumbs = [
{ {
'url':reverse('virtualevents_view'), 'url':reverse('virtualevents_view'),
@@ -1687,6 +1689,7 @@ def virtualevent_register_view(request,id=0):
sex=sex, sex=sex,
age=age, age=age,
entrycategory=coursestandard, entrycategory=coursestandard,
referencespeed=referencespeed,
) )
record.save() record.save()

View File

@@ -50,7 +50,7 @@
} }
html { html {
font-size: 62.5%; font-size: 62.5%;
margin: 0px; margin: 0px;
height: 100%; height: 100%;
width: 100%; width: 100%;
@@ -96,13 +96,13 @@ cox {
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
*/ */
th { th {
font-weight: bold; font-weight: bold;
align: left; align: left;
} }
.listtable tbody tr:nth-of-type(even) { background-color: #DDD; } .listtable tbody tr:nth-of-type(even) { background-color: #DDD; }
.listtable thead th { .listtable thead th {
font-weight: bold; font-weight: bold;
align: left; align: left;
} }
@@ -112,6 +112,10 @@ th {
.paddedtable td { padding: 1px 20px } .paddedtable td { padding: 1px 20px }
.shortpadded th { padding: 3px 3px }
.paddedtable th { padding: 1px 20px }
.cortable { .cortable {
border-collapse: collapse; border-collapse: collapse;
} }
@@ -124,12 +128,12 @@ th {
th.rotate { th.rotate {
/* Something you can count on */ /* Something you can count on */
height: 120px; height: 120px;
white-space: nowrap; white-space: nowrap;
} }
th.rotate > div { th.rotate > div {
transform: transform:
/* Magic Numbers */ /* Magic Numbers */
translate(28px, 91px) translate(28px, 91px)
/* 45 is really 360 - 45 */ /* 45 is really 360 - 45 */
@@ -141,12 +145,12 @@ th.rotate > div > span {
padding: 5px 5px; padding: 5px 5px;
} }
.fixtable table { .fixtable table {
table-layout: fixed; table-layout: fixed;
width: 60%; width: 60%;
} }
.message { .message {
border: 1px solid #000; border: 1px solid #000;
background-color: #f88; background-color: #f88;
font-weight: bold; font-weight: bold;
@@ -172,7 +176,7 @@ th.rotate > div > span {
background-color: #fee; background-color: #fee;
} }
.successmessage { .successmessage {
border: 1px solid #000; border: 1px solid #000;
background-color: #8f8; background-color: #8f8;
color: #000; color: #000;
@@ -180,7 +184,7 @@ th.rotate > div > span {
font-weight: bold; font-weight: bold;
} }
.deletelink { .deletelink {
border: 1px solid #000; border: 1px solid #000;
background-color: #f88; background-color: #f88;
color: #000; color: #000;
@@ -189,7 +193,7 @@ th.rotate > div > span {
} }
.navbar { .navbar {
border: 1px solid #666; border: 1px solid #666;
color: #000; color: #000;
@@ -199,7 +203,7 @@ th.rotate > div > span {
text-align: center; text-align: center;
} }
.navbutton { .navbutton {
background-color: #ddd; background-color: #ddd;
-moz-border-radius: 15px; -moz-border-radius: 15px;
-webkit-border-radius: 15px; -webkit-border-radius: 15px;
@@ -242,7 +246,7 @@ th.rotate > div > span {
transition-delay:1s; transition-delay:1s;
} }
.caption { .caption {
text-align: center; text-align: center;
} }
@@ -263,7 +267,7 @@ th.rotate > div > span {
font: 1.0em/1.2em sans-serif; font: 1.0em/1.2em sans-serif;
text-decoration: none; text-decoration: none;
display: block; display: block;
padding: .2em .5em .2em .5em; padding: .2em .5em .2em .5em;
zoom: 1; zoom: 1;
/* border-radius: .5em; */ /* border-radius: .5em; */
/* -moz-border-radius: .5em; */ /* -moz-border-radius: .5em; */
@@ -276,7 +280,7 @@ th.rotate > div > span {
font: 1.0em/1.2em sans-serif; font: 1.0em/1.2em sans-serif;
text-decoration: none; text-decoration: none;
display: block; display: block;
padding: .2em .5em .2em .5em; padding: .2em .5em .2em .5em;
zoom: 1; zoom: 1;
/* border-radius: .5em; */ /* border-radius: .5em; */
/* -moz-border-radius: .5em; */ /* -moz-border-radius: .5em; */
@@ -304,7 +308,7 @@ th.rotate > div > span {
} }
.dot:hover { .dot:hover {
text-decoration: none; text-decoration: none;
} }
.rounder { .rounder {
@@ -345,9 +349,9 @@ th.rotate > div > span {
-webkit-box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4); -webkit-box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4);
-moz-box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4); -moz-box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4);
box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4); box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4);
line-height: 0; /* ensure no space between bottom */ line-height: 0; /* ensure no space between bottom */
} }
.vignet img { .vignet img {
@@ -367,9 +371,9 @@ th.rotate > div > span {
-webkit-box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4); -webkit-box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4);
-moz-box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4); -moz-box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4);
box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4); box-shadow: inset 0px 0px 85px rgba(0,0,0,0.4);
line-height: 0; /* ensure no space between bottom */ line-height: 0; /* ensure no space between bottom */
} }
.vignet2 img { .vignet2 img {
@@ -751,7 +755,7 @@ th.rotate > div > span {
padding: 1em; padding: 1em;
text-align: left; text-align: left;
line-height: 1.5em; line-height: 1.5em;
word-wrap: break-word; word-wrap: break-word;
} }
.talktext p{ .talktext p{
/* remove webkit p margins */ /* remove webkit p margins */
@@ -776,7 +780,7 @@ th.rotate > div > span {
/* paleblue */ /* paleblue */
.paleblue { .paleblue {
# padding: 8px; # padding: 8px;
background: aliceblue; background: aliceblue;
box-shadow:inset 0px 0px 0px 6px #fff; box-shadow:inset 0px 0px 0px 6px #fff;
-moz-box-shadow:inset 0px 0px 0px 6px #fff; -moz-box-shadow:inset 0px 0px 0px 6px #fff;
@@ -948,7 +952,7 @@ th.rotate > div > span {
.greenbar { .greenbar {
border: 1px solid #666; border: 1px solid #666;
color: #000; color: #000;
@@ -959,7 +963,7 @@ th.rotate > div > span {
} }
#footer { #footer {
text-align:center; text-align:center;
} }
@@ -1016,21 +1020,21 @@ th.rotate > div > span {
background-color: #3e8e41; background-color: #3e8e41;
} }
.flexplot { .flexplot {
position: relative; position: relative;
z-index: 10; z-index: 10;
} }
a.wh:link { a.wh:link {
color: #e9e9e9; color: #e9e9e9;
} }
a.wh:visited { a.wh:visited {
color: #e9e9e9; color: #e9e9e9;
} }
a.wh:hover { a.wh:hover {
color: #e9e9e9; color: #e9e9e9;
} }
@@ -1067,7 +1071,7 @@ a.wh:hover {
.icon-link a:hover, a:active, a:visited, a:link { .icon-link a:hover, a:active, a:visited, a:link {
/* color: #1c75bc; */ /* color: #1c75bc; */
text-decoration: none; text-decoration: none;
} }
@@ -1086,9 +1090,9 @@ a.wh:hover {
} }
.mystyle { .mystyle {
font-size: 11pt; font-size: 11pt;
font-family: Arial; font-family: Arial;
border-collapse: collapse; border-collapse: collapse;
border: 1px solid silver; border: 1px solid silver;
} }

File diff suppressed because one or more lines are too long