From d20272d05118eaf1b2c5329b0823692293b9a549 Mon Sep 17 00:00:00 2001
From: Sander Roosendaal
Date: Sun, 31 May 2020 21:57:12 +0200
Subject: [PATCH] tasks.py
---
rowers/plannedsessions.py | 2 +-
rowers/tasks.py | 36 ++++++++++------------
rowers/templates/virtualeventregister.html | 2 --
3 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py
index 3b81566f..a509c617 100644
--- a/rowers/plannedsessions.py
+++ b/rowers/plannedsessions.py
@@ -1552,7 +1552,7 @@ 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
)
diff --git a/rowers/tasks.py b/rowers/tasks.py
index 93f77b4d..f2408632 100644
--- a/rowers/tasks.py
+++ b/rowers/tasks.py
@@ -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,30 +489,28 @@ 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(
- 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,
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} 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,
duration=totaltime_sec_to_string(coursetimeseconds),
distance=int(coursemeters),
-# points=points,
+ points=points,
workoutid=workoutid,
startsecond=startsecond,
endsecond=endsecond,
diff --git a/rowers/templates/virtualeventregister.html b/rowers/templates/virtualeventregister.html
index ec01f4b3..6a925ac7 100644
--- a/rowers/templates/virtualeventregister.html
+++ b/rowers/templates/virtualeventregister.html
@@ -35,7 +35,6 @@
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).
- {% comment %}
{% if race.coursestandards %}
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
@@ -46,7 +45,6 @@
You can check the valid race groups and standard times here.
{% endif %}
- {% endcomment %}