From ffb089a0c0992089b51ada179fffb87191c88b83 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 10 Nov 2020 08:15:28 +0100 Subject: [PATCH 1/2] small improvements --- rowers/models.py | 16 ++++++++-------- rowers/templates/plannedsessionteamcreate.html | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/rowers/models.py b/rowers/models.py index 5713e93a..1dcfd8ce 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2131,8 +2131,8 @@ regularsessiontypechoices = ( ('test','Mandatory Test'), ('cycletarget','Total for a time period'), ('coursetest','OTW test over a course'), - ('fastest_distance','Finds fastest time over a given distance'), - ('fastest_time','Finds largest distance rowed over a given time'), + ('fastest_distance','Finds fastest time over a given distance on the water'), + ('fastest_time','Finds largest distance rowed on the water over a given time'), ) # model for Planned Session (Workout, Challenge, Test) @@ -2145,8 +2145,8 @@ class PlannedSession(models.Model): ('test','Mandatory Test'), ('cycletarget','Total for a time period'), ('coursetest','OTW test over a course'), - ('fastest_distance','Finds fastest time over a given distance'), - ('fastest_time','Finds largest distance rowed over a given time'), + ('fastest_distance','Finds fastest time over a given distance on the water'), + ('fastest_time','Finds largest distance rowed on the water over a given time'), ('race','Virtual challenge'), ('indoorrace','Indoor Virtual challenge'), ) @@ -2157,8 +2157,8 @@ class PlannedSession(models.Model): ('test','Mandatory Test'), ('cycletarget','Total for a time period'), ('coursetest','OTW test over a course'), - ('fastest_distance','Finds fastest time over a given distance'), - ('fastest_time','Finds largest distance rowed over a given time'), + ('fastest_distance','Finds fastest time over a given distance on the water'), + ('fastest_time','Finds largest distance rowed on the water over a given time'), ) sessionmodechoices = ( @@ -2838,8 +2838,8 @@ class PlannedSessionFormSmall(ModelForm): ('test','Mandatory Test'), ('cycletarget','Total for a time period'), ('coursetest','OTW test over a course'), - ('fastest_distance','Finds fastest time over a given distance'), - ('fastest_time','Finds largest distance rowed over a given time'), + ('fastest_distance','Finds fastest time over a given distance on the water'), + ('fastest_time','Finds largest distance rowed on the water over a given time'), ) class Meta: diff --git a/rowers/templates/plannedsessionteamcreate.html b/rowers/templates/plannedsessionteamcreate.html index 55dabe13..e9d3235c 100644 --- a/rowers/templates/plannedsessionteamcreate.html +++ b/rowers/templates/plannedsessionteamcreate.html @@ -207,6 +207,21 @@ $("td #id_course").hide(); } + if (this.value == 'fastest_distance') { + $("td #id_criterium").prop("value","exact"); + $("td #id_sessionunit").prop("value","m"); + $("td #id_sessionmode").prop("value","distance") + $('#id_guidance').html("

For Fastest Distance, set an exact number of meters

"); + } + + if (this.value == 'fastest_time') { + $("td #id_criterium").prop("value","exact"); + $("td #id_sessionunit").prop("value","min"); + $("td #id_sessionmode").prop("value","time") + $('#id_guidance').html("

For Fastest Time, set an exact number of minutes

"); + } + + if (this.value == 'challenge') { $("td #id_criterium").prop("value","minimum"); From 2f12c577b41ce755438f3274f7af88f0adcbc558 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Tue, 10 Nov 2020 18:51:13 +0100 Subject: [PATCH 2/2] bug fix --- rowers/plannedsessions.py | 8 +- .../templates/fastestvirtualeventcreate.html | 117 ++++++++++++++++++ 2 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 rowers/templates/fastestvirtualeventcreate.html diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index 03e34e0a..888ccb47 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -407,7 +407,7 @@ def add_workouts_plannedsession(ws,ps,r): duration = to_time(1000.*fastest_milliseconds) record = CourseTestResult( - userid=w.user.id, + userid=w.user.user.id, plannedsession = ps, duration = duration, coursecompleted = True, @@ -418,7 +418,7 @@ def add_workouts_plannedsession(ws,ps,r): record.save() else: record = CourseTestResult( - userid = w.user.id, + userid = w.user.user.id, workoutid=w.id, plannedsession = ps, duration = dt.time(0,0), @@ -438,7 +438,7 @@ def add_workouts_plannedsession(ws,ps,r): duration = dt.time(0,ps.sessionvalue) record = CourseTestResult( - userid=w.user.id, + userid=w.user.user.id, workoutid=w.id, plannedsession = ps, duration = duration, @@ -448,7 +448,7 @@ def add_workouts_plannedsession(ws,ps,r): record.save() else: record = CourseTestResult( - userid = w.user.id, + userid = w.user.user.id, plannedsession = ps, workoutid=w.id, duration = dt.time(0,ps.sessionvalue), diff --git a/rowers/templates/fastestvirtualeventcreate.html b/rowers/templates/fastestvirtualeventcreate.html new file mode 100644 index 00000000..7034c3f3 --- /dev/null +++ b/rowers/templates/fastestvirtualeventcreate.html @@ -0,0 +1,117 @@ +{% extends "newbase.html" %} +{% load staticfiles %} +{% load rowerfilters %} + +{% block title %}New Virtual Challenge{% endblock %} + +{% block main %} + +

New On-The-Water Virtual Challenge

+ +
    +
  • +

    With this form, you can create a new virtual challenge. After you submit + the form, the challenge is created and will be visible to all users. From + that moment, only the site admin can delete the challenge + (admin@rowsandall.com). You can still edit the challenge until + the start of the challenge window. +

    +
  • + +
  • +
    + {% if form.errors %} +

    + Please correct the error{{ form.errors|pluralize }} below. +

    + {% endif %} +

    + + {{ form.as_table }} +
    +

    +

    + {% csrf_token %} + +

    +
    +
  • +
  • +

    +

      +

      All times are local times in the time zone you select

      +

      Adding a contact phone number and email is not mandatory, but we + strongly recommend it.

      +

      If your event has a registration closure deadline, participants + have to enter (and can withdraw) before the registration closure time.

      +

      Participants can submit results until the evaluation closure time.

      +

      Until one hour after evaluation closure time, the challenge organizer + can review and reject submitted results ("disqualification"). If + you as the challenge organizer intend to use this functionality, it + is strongly recommended that you fill out a contact email or phone + number. +

      +

      + The participants can row this challenge on any course, and their fastest time + over the challenge distance (respectively the largest distance achieved over the + challenge duration) is automatically extracted from the workout. No + need to program a set piece. +

      +

      + 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. +

      +
    +

    +
  • +
+ + +{% endblock %} + +{% block scripts %} + + +{% endblock %} + +{% block sidebar %} +{% include 'menu_racing.html' %} +{% endblock %}