diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index 7babb4f7..93fd2322 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -25,6 +25,8 @@ from rowers.models import ( from rowers.courses import get_time_course +import rowers.mytypes as mytypes + import metrics import numpy as np import dataprep @@ -35,7 +37,6 @@ from rowers.tasks import handle_check_race_course def get_indoorraces(workout): races1 = VirtualRace.objects.filter( - registration_closure__gt=timezone.now(), sessiontype='indoorrace', startdate__lte=workout.date, enddate__gte=workout.date, @@ -48,7 +49,6 @@ def get_indoorraces(workout): races2 = VirtualRace.objects.filter( - registration_closure__gt=timezone.now(), sessiontype='indoorrace', startdate__lte=workout.date, enddate__gte=workout.date, @@ -1009,6 +1009,9 @@ def add_workout_indoorrace(ws,race,r,recordid=0): record.duration = ws[0].duration + if ws[0].workouttype not in mytypes.otetypes: + errors.append('You must submit a indoor rowing workout') + return 0,comments, errors, 0 if ws[0].weightcategory != record.weightcategory: errors.append('Your workout weight category did not match the weight category you registered') @@ -1102,6 +1105,11 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0): errors.append("Couldn't find this entry") return result,comments,errors,0 + if ws[0].workouttype not in mytypes.otwtypes: + errors.append('You have to submit a rowing on water workout') + return 0,comments,errors,0 + + if ws[0].boattype != record.boattype: errors.append('Your workout boat type did not match the boat type you registered') return 0,comments,errors,0 diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index 986878ec..d2fd7321 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -123,7 +123,7 @@ $('#id_workouttype').change();
- Submit this to Indoor Race {{ race.name }} + Submit this to Indoor Race {{ race.name }}
{% endfor %} diff --git a/rowers/urls.py b/rowers/urls.py index 76ffa360..242c07b4 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -158,6 +158,8 @@ urlpatterns = [ url(r'^virtualevent/(?P