Merge branch 'feature/racenotifications' into develop
This commit is contained in:
+31
-1
@@ -1,6 +1,9 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
from rowers.models import Workout,Rower,Team,PlannedSession,GeoCourse
|
from rowers.models import (
|
||||||
|
Workout,Rower,Team,PlannedSession,GeoCourse,
|
||||||
|
VirtualRace,VirtualRaceResult,IndoorVirtualRaceResult
|
||||||
|
)
|
||||||
from rowers.rows import validate_file_extension,must_be_csv,validate_image_extension,validate_kml
|
from rowers.rows import validate_file_extension,must_be_csv,validate_image_extension,validate_kml
|
||||||
from django.contrib.auth.forms import UserCreationForm
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
@@ -16,6 +19,7 @@ from utils import landingpages
|
|||||||
from metrics import axes
|
from metrics import axes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# login form
|
# login form
|
||||||
class LoginForm(forms.Form):
|
class LoginForm(forms.Form):
|
||||||
username = forms.CharField()
|
username = forms.CharField()
|
||||||
@@ -254,6 +258,10 @@ class UploadOptionsForm(forms.Form):
|
|||||||
makeprivate = forms.BooleanField(initial=False,required=False,
|
makeprivate = forms.BooleanField(initial=False,required=False,
|
||||||
label='Make Workout Private')
|
label='Make Workout Private')
|
||||||
|
|
||||||
|
submitrace = forms.ModelChoiceField(queryset=VirtualRace.objects.all(),
|
||||||
|
label='Submit as Race Result',
|
||||||
|
required=False)
|
||||||
|
|
||||||
landingpage = forms.ChoiceField(choices=nextpages,
|
landingpage = forms.ChoiceField(choices=nextpages,
|
||||||
initial='workout_edit_view',
|
initial='workout_edit_view',
|
||||||
label='After Upload, go to')
|
label='After Upload, go to')
|
||||||
@@ -261,6 +269,28 @@ class UploadOptionsForm(forms.Form):
|
|||||||
class Meta:
|
class Meta:
|
||||||
fields = ['make_plot','plottype','upload_toc2','makeprivate']
|
fields = ['make_plot','plottype','upload_toc2','makeprivate']
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
self.request = kwargs.pop('request',None)
|
||||||
|
super(UploadOptionsForm, self).__init__(*args, **kwargs)
|
||||||
|
r = Rower.objects.get(user=self.request.user)
|
||||||
|
races = VirtualRace.objects.filter(
|
||||||
|
registration_closure__gt=timezone.now(),
|
||||||
|
sessiontype='indoorrace')
|
||||||
|
registrations = IndoorVirtualRaceResult.objects.filter(
|
||||||
|
race__in = races,
|
||||||
|
userid = r.id)
|
||||||
|
|
||||||
|
raceids = [r.race.id for r in registrations]
|
||||||
|
|
||||||
|
races = VirtualRace.objects.filter(
|
||||||
|
id__in=raceids
|
||||||
|
)
|
||||||
|
|
||||||
|
if races:
|
||||||
|
self.fields['submitrace'].queryset = races
|
||||||
|
else:
|
||||||
|
del self.fields['submitrace']
|
||||||
|
|
||||||
# The form to indicate additional actions to be performed immediately
|
# The form to indicate additional actions to be performed immediately
|
||||||
# after a successful upload. This version allows the Team manager to select
|
# after a successful upload. This version allows the Team manager to select
|
||||||
# a team member
|
# a team member
|
||||||
|
|||||||
+5
-1
@@ -2422,6 +2422,8 @@ class VirtualRaceResult(models.Model):
|
|||||||
verbose_name='Gender')
|
verbose_name='Gender')
|
||||||
|
|
||||||
age = models.IntegerField(null=True)
|
age = models.IntegerField(null=True)
|
||||||
|
emailnotifications = models.BooleanField(default=True,
|
||||||
|
verbose_name = 'Receive race notifications by email')
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
rr = Rower.objects.get(id=self.userid)
|
rr = Rower.objects.get(id=self.userid)
|
||||||
@@ -2472,6 +2474,8 @@ class IndoorVirtualRaceResult(models.Model):
|
|||||||
verbose_name='Gender')
|
verbose_name='Gender')
|
||||||
|
|
||||||
age = models.IntegerField(null=True)
|
age = models.IntegerField(null=True)
|
||||||
|
emailnotifications = models.BooleanField(default=True,
|
||||||
|
verbose_name = 'Receive race notifications by email')
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
rr = Rower.objects.get(id=self.userid)
|
rr = Rower.objects.get(id=self.userid)
|
||||||
@@ -2686,7 +2690,7 @@ class WorkoutForm(ModelForm):
|
|||||||
startdate__lte=workout.date,
|
startdate__lte=workout.date,
|
||||||
enddate__gte=workout.date,
|
enddate__gte=workout.date,
|
||||||
).order_by("preferreddate","startdate","enddate").exclude(
|
).order_by("preferreddate","startdate","enddate").exclude(
|
||||||
sessiontype='race')
|
sessiontype__in=['race','indoorrace'])
|
||||||
|
|
||||||
if not sps:
|
if not sps:
|
||||||
del self.fields['plannedsession']
|
del self.fields['plannedsession']
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from rowers.models import (
|
|||||||
Rower, Workout,Team,
|
Rower, Workout,Team,
|
||||||
GeoCourse, TrainingMicroCycle,TrainingMesoCycle,TrainingMacroCycle,
|
GeoCourse, TrainingMicroCycle,TrainingMesoCycle,TrainingMacroCycle,
|
||||||
TrainingPlan,PlannedSession,VirtualRaceResult,CourseTestResult,
|
TrainingPlan,PlannedSession,VirtualRaceResult,CourseTestResult,
|
||||||
get_course_timezone, IndoorVirtualRaceResult
|
get_course_timezone, IndoorVirtualRaceResult,VirtualRace
|
||||||
)
|
)
|
||||||
|
|
||||||
from rowers.courses import get_time_course
|
from rowers.courses import get_time_course
|
||||||
@@ -33,6 +33,41 @@ import iso8601
|
|||||||
from iso8601 import ParseError
|
from iso8601 import ParseError
|
||||||
from rowers.tasks import handle_check_race_course
|
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,
|
||||||
|
sessionmode='distance',
|
||||||
|
sessionvalue=workout.distance)
|
||||||
|
|
||||||
|
|
||||||
|
if workout.duration.second != 0 and workout.duration.microsecond != 0:
|
||||||
|
duration = 60*workout.duration.hour+workout.duration.minute
|
||||||
|
|
||||||
|
|
||||||
|
races2 = VirtualRace.objects.filter(
|
||||||
|
registration_closure__gt=timezone.now(),
|
||||||
|
sessiontype='indoorrace',
|
||||||
|
startdate__lte=workout.date,
|
||||||
|
enddate__gte=workout.date,
|
||||||
|
sessionmode='time',
|
||||||
|
sessionvalue=duration)
|
||||||
|
|
||||||
|
races = races1 | races2
|
||||||
|
else:
|
||||||
|
races = races1
|
||||||
|
|
||||||
|
registrations = IndoorVirtualRaceResult.objects.filter(
|
||||||
|
race__in = races,
|
||||||
|
userid=workout.user.id)
|
||||||
|
|
||||||
|
races = [r.race for r in registrations]
|
||||||
|
|
||||||
|
|
||||||
|
return races
|
||||||
|
|
||||||
def get_todays_micro(plan,thedate=date.today()):
|
def get_todays_micro(plan,thedate=date.today()):
|
||||||
thismicro = None
|
thismicro = None
|
||||||
|
|
||||||
@@ -729,10 +764,11 @@ def race_can_submit(r,race):
|
|||||||
if is_complete == False:
|
if is_complete == False:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
print 'pop'
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def race_can_resubmit(r,race):
|
def race_can_resubmit(r,race):
|
||||||
@@ -970,6 +1006,7 @@ def add_workout_indoorrace(ws,race,r,recordid=0):
|
|||||||
record.duration = ws[0].duration
|
record.duration = ws[0].duration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ws[0].weightcategory != record.weightcategory:
|
if ws[0].weightcategory != record.weightcategory:
|
||||||
errors.append('Your workout weight category did not match the weight category you registered')
|
errors.append('Your workout weight category did not match the weight category you registered')
|
||||||
return 0,comments, errors,0
|
return 0,comments, errors,0
|
||||||
@@ -993,7 +1030,7 @@ def add_workout_indoorrace(ws,race,r,recordid=0):
|
|||||||
record.coursecompleted = True
|
record.coursecompleted = True
|
||||||
record.workoutid = ws[0].id
|
record.workoutid = ws[0].id
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
add_workouts_plannedsession(ws,race,r)
|
add_workouts_plannedsession(ws,race,r)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -740,6 +740,66 @@ def handle_updatedps(useremail, workoutids, debug=False,**kwargs):
|
|||||||
|
|
||||||
# send email when a breakthrough workout is uploaded
|
# send email when a breakthrough workout is uploaded
|
||||||
|
|
||||||
|
@app.task
|
||||||
|
def handle_sendemail_raceregistration(
|
||||||
|
useremail, username, registeredname, racename, raceid, **kwargs):
|
||||||
|
|
||||||
|
if 'debug' in kwargs:
|
||||||
|
debug = kwargs['debug']
|
||||||
|
else:
|
||||||
|
debug = True
|
||||||
|
|
||||||
|
subject = "A new competitor has registered for virtual race {n}".format(
|
||||||
|
n = racename
|
||||||
|
)
|
||||||
|
|
||||||
|
from_email = 'Rowsandall <info@rowsandall.com>'
|
||||||
|
|
||||||
|
d = {
|
||||||
|
'username':username,
|
||||||
|
'registeredname':registeredname,
|
||||||
|
'siteurl':siteurl,
|
||||||
|
'racename':racename,
|
||||||
|
'raceid':raceid,
|
||||||
|
}
|
||||||
|
|
||||||
|
res = send_template_email(from_email,[useremail],
|
||||||
|
subject,
|
||||||
|
'raceregisteredemail.html',
|
||||||
|
d,**kwargs)
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
@app.task
|
||||||
|
def handle_sendemail_racesubmission(
|
||||||
|
useremail, username, registeredname, racename, raceid, **kwargs):
|
||||||
|
|
||||||
|
if 'debug' in kwargs:
|
||||||
|
debug = kwargs['debug']
|
||||||
|
else:
|
||||||
|
debug = True
|
||||||
|
|
||||||
|
subject = "A new result has been submitted for virtual race {n}".format(
|
||||||
|
n = racename
|
||||||
|
)
|
||||||
|
|
||||||
|
from_email = 'Rowsandall <info@rowsandall.com>'
|
||||||
|
|
||||||
|
d = {
|
||||||
|
'username':username,
|
||||||
|
'siteurl':siteurl,
|
||||||
|
'registeredname':registeredname,
|
||||||
|
'racename':racename,
|
||||||
|
'raceid':raceid,
|
||||||
|
}
|
||||||
|
|
||||||
|
res = send_template_email(from_email,[useremail],
|
||||||
|
subject,
|
||||||
|
'racesubmissionemail.html',
|
||||||
|
d,**kwargs)
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
@app.task
|
@app.task
|
||||||
def handle_send_disqualification_email(
|
def handle_send_disqualification_email(
|
||||||
useremail,username,reason,message, racename, **kwargs):
|
useremail,username,reason,message, racename, **kwargs):
|
||||||
@@ -758,6 +818,7 @@ def handle_send_disqualification_email(
|
|||||||
d = {
|
d = {
|
||||||
'username':username,
|
'username':username,
|
||||||
'reason':reason,
|
'reason':reason,
|
||||||
|
'siteurl':siteurl,
|
||||||
'message': strip_tags(message),
|
'message': strip_tags(message),
|
||||||
'racename':racename,
|
'racename':racename,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Unfortunately, the result that you have submitted
|
Unfortunately, the result that you have submitted
|
||||||
for the virtual race {{ racename }}
|
for the virtual race
|
||||||
|
{{ racename }}
|
||||||
has been rejected by the race organizer.
|
has been rejected by the race organizer.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,82 @@
|
|||||||
<i class="far fa-flag fa-fw"></i> New Indoor Race
|
<i class="far fa-flag fa-fw"></i> New Indoor Race
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% if race %}
|
||||||
|
{% if reguest.user.is_anonymous %}
|
||||||
|
<li id="race-register">
|
||||||
|
{% if race.sessiontype == 'race' %}
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/register">
|
||||||
|
<i class="fas fa-user-plus fa-fw"></i> Register</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/registerindoor">
|
||||||
|
<i class="fas fa-user-plus fa-fw"></i> Register</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% for button in buttons %}
|
||||||
|
{% if button == 'registerbutton' %}
|
||||||
|
<li>
|
||||||
|
{% if race.sessiontype == 'race' %}
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/register">
|
||||||
|
<i class="fas fa-user-plus fa-fw"></i> Register</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/registerindoor">
|
||||||
|
<i class="fas fa-user-plus fa-fw"></i> Register</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if button == 'submitbutton' %}
|
||||||
|
<li>
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/submit">
|
||||||
|
<i class="fas fa-file-plus fa-fw"></i> Submit Workout</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/rowers/workout/upload">
|
||||||
|
<i class="fas fa-file-upload fa-fw"></i> Upload your race result
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/rowers/addmanual">
|
||||||
|
<i class="fas fa-file-plus fa-fw"></i> Enter Result
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if button == 'resubmitbutton' %}
|
||||||
|
<li>
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/submit">Submit New Result</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if button == 'withdrawbutton' %}
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/withdraw">
|
||||||
|
<i class="fas fa-user-minus fa-fw"></i> Withdraw</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if button == 'adddisciplinebutton' %}
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/adddiscipline">
|
||||||
|
<i class="fas fa-users fa-fw"></i> Register New Boat
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if button == 'editbutton' %}
|
||||||
|
<li>
|
||||||
|
{% if race.sessiontype == 'race' %}
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/edit"><i class="fas fa-pencil-alt fa-fw"></i> Edit Race
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/editindoor"><i class="fas fa-pencil-alt fa-fw"></i> Edit Race
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
<li id="courses">
|
<li id="courses">
|
||||||
<a href="/rowers/list-courses">
|
<a href="/rowers/list-courses">
|
||||||
<i class="fas fa-map-marked fa-fw"></i> Courses
|
<i class="fas fa-route fa-fw"></i> Courses
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if course %}
|
{% if course %}
|
||||||
<li class="has-children" id="course">
|
<li class="has-children" id="course">
|
||||||
<input type="checkbox" name="group-course" id="group-course" checked>
|
<input type="checkbox" name="group-course" id="group-course" checked>
|
||||||
<label for="group-course"><i class="fas fa-map-marked fa-fw"></i> {{ course.name }}</label>
|
<label for="group-course"><i class="fas fa-route fa-fw"></i> {{ course.name }}</label>
|
||||||
<ul>
|
<ul>
|
||||||
<li id="course-view">
|
<li id="course-view">
|
||||||
<a href="/rowers/courses/{{ course.id }}">
|
<a href="/rowers/courses/{{ course.id }}">
|
||||||
|
|||||||
@@ -37,10 +37,10 @@
|
|||||||
{% if rower %}
|
{% if rower %}
|
||||||
{% if race|can_register:rower %}
|
{% if race|can_register:rower %}
|
||||||
<a class="white dot" href="/rowers/virtualevent/{{ race.id }}"> </a>
|
<a class="white dot" href="/rowers/virtualevent/{{ race.id }}"> </a>
|
||||||
{% elif race|can_submit:rower %}
|
|
||||||
<a class="orange dot" href="/rowers/virtualevent/{{ race.id }}"> </a>
|
|
||||||
{% elif race|race_complete:rower %}
|
{% elif race|race_complete:rower %}
|
||||||
<a class="green dot" href="/rowers/virtualevent/{{ race.id }}"> </a>
|
<a class="green dot" href="/rowers/virtualevent/{{ race.id }}"> </a>
|
||||||
|
{% elif race|can_submit:rower %}
|
||||||
|
<a class="orange dot" href="/rowers/virtualevent/{{ race.id }}"> </a>
|
||||||
{% elif race|future_registered:rower %}
|
{% elif race|future_registered:rower %}
|
||||||
<a class="orange dot" href="/rowers/virtualevent/{{ race.id }}"> </a>
|
<a class="orange dot" href="/rowers/virtualevent/{{ race.id }}"> </a>
|
||||||
{% elif race|past_not_registered:rower %}
|
{% elif race|past_not_registered:rower %}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{% extends "emailbase.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<p>Dear <strong>{{ username }}</strong>,</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
A new competitor has registered for the race {{ racename }}: {{ registeredname }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You can check race participants and results on the race page on Rowsandall:
|
||||||
|
<a href="{{ siteurl }}/rowers/virtualevent/{{ raceid }}">{{ racename }}</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You are receiving this email because you are on the start list for this race.
|
||||||
|
If you do not wish to receive these notifications, you can switch them off
|
||||||
|
throught the link above.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Best Regards, the Rowsandall Team
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{% extends "emailbase.html" %}
|
||||||
|
{% block body %}
|
||||||
|
<p>Dear <strong>{{ username }}</strong>,</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
One of your competitors, {{ registeredname }}, has submitted a result for {{ racename }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Check out the results on the race page!
|
||||||
|
<a href="{{ siteurl }}/rowers/virtualevent/{{ raceid }}">{{ racename }}</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You are receiving this email because you are on the start list for this race.
|
||||||
|
If you do not wish to receive these notifications, you can switch them off
|
||||||
|
throught the link above.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Best Regards, the Rowsandall Team
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
@@ -39,8 +39,12 @@
|
|||||||
<p>
|
<p>
|
||||||
<a class="twitter-share-button"
|
<a class="twitter-share-button"
|
||||||
href="https://twitter.com/intent/tweet"
|
href="https://twitter.com/intent/tweet"
|
||||||
data-url="{{ request.build_absolute_uri }}"
|
data-url="{{ request.build_absolute_uri }}"
|
||||||
data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{ race.name }}'">Tweet</a>
|
{% if race.sessiontype == 'race' %}
|
||||||
|
data-text="@rowsandall #rowingdata Participate in virtual race '{{ race.name }}'">Tweet</a>
|
||||||
|
{% else %}
|
||||||
|
data-text="@rowsandall #rowingdata Participate in Indoor Rowing virtual race '{{ race.name }}'">Tweet</a>
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +155,37 @@
|
|||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if button == 'submitbutton' %}
|
{% if button == 'submitbutton' %}
|
||||||
<a href="/rowers/virtualevent/{{ race.id }}/submit">Submit Result</a>
|
<table width=100% class="shortpadded">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/submit">Submit Workout</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Submit a workout that is already on the site as your race result
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="/rowers/upload">Upload your race result</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
Upload a new workout to the site and submit it as a result. You
|
||||||
|
need a workout data file.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% if race.sessiontype == 'indoorrace' %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="/rowers/addmanual">Enter your race result manually</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
If you don't have a data file, enter the results
|
||||||
|
manually. If you have a photo of the monitor with the
|
||||||
|
result, it is recommended to add this to the workout.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if button == 'resubmitbutton' %}
|
{% if button == 'resubmitbutton' %}
|
||||||
<p>
|
<p>
|
||||||
@@ -283,7 +317,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input class="button green" type="submit" value="Submit">
|
<input type="submit" value="Submit">
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -327,6 +361,31 @@
|
|||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% for record in records %}
|
||||||
|
{% if record.userid == request.user.rower.id %}
|
||||||
|
{% if race.sessiontype == 'race' %}
|
||||||
|
{% if record.emailnotifications %}
|
||||||
|
<a href="/rowers/raceregistration/togglenotification/{{ race.id }}">
|
||||||
|
Unsubscribe from race notifications by email
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/rowers/raceregistration/togglenotification/{{ race.id }}">
|
||||||
|
Subscribe to race notifications by email
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if record.emailnotifications %}
|
||||||
|
<a href="/rowers/indoorraceregistration/togglenotification/{{ race.id }}">
|
||||||
|
Unsubscribe from race notifications by email
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/rowers/indoorraceregistration/togglenotification/{{ race.id }}">
|
||||||
|
Subscribe to race notifications by email
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
<div id="rules">
|
<div id="rules">
|
||||||
|
|||||||
@@ -118,6 +118,16 @@ $('#id_workouttype').change();
|
|||||||
</pre>
|
</pre>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
{% if indoorraces %}
|
||||||
|
<li>
|
||||||
|
<h1>Racing</h1>
|
||||||
|
{% for race in indoorraces %}
|
||||||
|
<p>
|
||||||
|
<a href="/rowers/virtualevent/{{ race.id }}/submit">Submit this to Indoor Race {{ race.name }}</a>
|
||||||
|
</p>
|
||||||
|
{% endfor %}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
{% if mapdiv %}
|
{% if mapdiv %}
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
|
<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
|
||||||
|
|||||||
@@ -144,6 +144,10 @@ urlpatterns = [
|
|||||||
url(r'^virtualevents$',views.virtualevents_view),
|
url(r'^virtualevents$',views.virtualevents_view),
|
||||||
url(r'^virtualevent/create$',views.virtualevent_create_view),
|
url(r'^virtualevent/create$',views.virtualevent_create_view),
|
||||||
url(r'^virtualevent/createindoor$',views.indoorvirtualevent_create_view),
|
url(r'^virtualevent/createindoor$',views.indoorvirtualevent_create_view),
|
||||||
|
url(r'^raceregistration/togglenotification/(?P<id>\d+)/$',
|
||||||
|
views.virtualevent_toggle_email_view),
|
||||||
|
url(r'^indoorraceregistration/togglenotification/(?P<id>\d+)/$',
|
||||||
|
views.indoorvirtualevent_toggle_email_view),
|
||||||
url(r'^virtualevent/(?P<id>\d+)$',views.virtualevent_view),
|
url(r'^virtualevent/(?P<id>\d+)$',views.virtualevent_view),
|
||||||
url(r'^virtualevent/(?P<id>\d+)/edit$',views.virtualevent_edit_view),
|
url(r'^virtualevent/(?P<id>\d+)/edit$',views.virtualevent_edit_view),
|
||||||
url(r'^virtualevent/(?P<id>\d+)/editindoor$',views.indoorvirtualevent_edit_view),
|
url(r'^virtualevent/(?P<id>\d+)/editindoor$',views.indoorvirtualevent_edit_view),
|
||||||
|
|||||||
+293
-2
@@ -168,6 +168,8 @@ from rowers.tasks import (
|
|||||||
handle_update_empower,
|
handle_update_empower,
|
||||||
handle_sendemailics,
|
handle_sendemailics,
|
||||||
handle_sendemail_userdeleted,
|
handle_sendemail_userdeleted,
|
||||||
|
handle_sendemail_raceregistration,
|
||||||
|
handle_sendemail_racesubmission,
|
||||||
)
|
)
|
||||||
|
|
||||||
from scipy.signal import savgol_filter
|
from scipy.signal import savgol_filter
|
||||||
@@ -3458,6 +3460,12 @@ def addmanual_view(request):
|
|||||||
add_workouts_plannedsession([w],ps,w.user)
|
add_workouts_plannedsession([w],ps,w.user)
|
||||||
|
|
||||||
messages.info(request,'New workout created')
|
messages.info(request,'New workout created')
|
||||||
|
|
||||||
|
url = reverse(
|
||||||
|
workout_edit_view,
|
||||||
|
kwargs={'id':id}
|
||||||
|
)
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
return render(request,'manualadd.html',
|
return render(request,'manualadd.html',
|
||||||
{'form':form,
|
{'form':form,
|
||||||
@@ -9977,6 +9985,8 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
|||||||
|
|
||||||
row = get_workout(id)
|
row = get_workout(id)
|
||||||
|
|
||||||
|
indoorraces = get_indoorraces(row)
|
||||||
|
|
||||||
if (checkworkoutuser(request.user,row)==False):
|
if (checkworkoutuser(request.user,row)==False):
|
||||||
raise PermissionDenied("Access denied")
|
raise PermissionDenied("Access denied")
|
||||||
|
|
||||||
@@ -10169,6 +10179,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
|||||||
'graphs':g,
|
'graphs':g,
|
||||||
'breadcrumbs':breadcrumbs,
|
'breadcrumbs':breadcrumbs,
|
||||||
'rower':r,
|
'rower':r,
|
||||||
|
'indoorraces':indoorraces,
|
||||||
'active':'nav-workouts',
|
'active':'nav-workouts',
|
||||||
'mapscript':mapscript,
|
'mapscript':mapscript,
|
||||||
'mapdiv':mapdiv,
|
'mapdiv':mapdiv,
|
||||||
@@ -11451,7 +11462,7 @@ def workout_upload_view(request,
|
|||||||
response = {}
|
response = {}
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = DocumentsForm(request.POST,request.FILES)
|
form = DocumentsForm(request.POST,request.FILES)
|
||||||
optionsform = UploadOptionsForm(request.POST)
|
optionsform = UploadOptionsForm(request.POST,request=request)
|
||||||
|
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
# f = request.FILES['file']
|
# f = request.FILES['file']
|
||||||
@@ -11480,6 +11491,7 @@ def workout_upload_view(request,
|
|||||||
notes = form.cleaned_data['notes']
|
notes = form.cleaned_data['notes']
|
||||||
offline = form.cleaned_data['offline']
|
offline = form.cleaned_data['offline']
|
||||||
|
|
||||||
|
race = None
|
||||||
if optionsform.is_valid():
|
if optionsform.is_valid():
|
||||||
make_plot = optionsform.cleaned_data['make_plot']
|
make_plot = optionsform.cleaned_data['make_plot']
|
||||||
plottype = optionsform.cleaned_data['plottype']
|
plottype = optionsform.cleaned_data['plottype']
|
||||||
@@ -11492,6 +11504,11 @@ def workout_upload_view(request,
|
|||||||
makeprivate = optionsform.cleaned_data['makeprivate']
|
makeprivate = optionsform.cleaned_data['makeprivate']
|
||||||
landingpage = optionsform.cleaned_data['landingpage']
|
landingpage = optionsform.cleaned_data['landingpage']
|
||||||
|
|
||||||
|
try:
|
||||||
|
race = optionsform.cleaned_data['submitrace']
|
||||||
|
except KeyError:
|
||||||
|
race = None
|
||||||
|
|
||||||
uploadoptions = {
|
uploadoptions = {
|
||||||
'makeprivate':makeprivate,
|
'makeprivate':makeprivate,
|
||||||
'make_plot':make_plot,
|
'make_plot':make_plot,
|
||||||
@@ -11677,6 +11694,28 @@ def workout_upload_view(request,
|
|||||||
else:
|
else:
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
|
|
||||||
|
if race and race_can_submit(r,race):
|
||||||
|
records = IndoorVirtualRaceResult.objects.filter(
|
||||||
|
race=race,
|
||||||
|
userid=r.id
|
||||||
|
)
|
||||||
|
|
||||||
|
if records:
|
||||||
|
|
||||||
|
result,comments,errors,jobid = add_workout_indoorrace(
|
||||||
|
[w],race,r,recordid=records[0].id
|
||||||
|
)
|
||||||
|
|
||||||
|
if result:
|
||||||
|
messages.info(
|
||||||
|
request,
|
||||||
|
"We have submitted your workout to the race")
|
||||||
|
|
||||||
|
for c in comments:
|
||||||
|
messages.info(request,c)
|
||||||
|
for er in errors:
|
||||||
|
messages.error(request,er)
|
||||||
|
|
||||||
|
|
||||||
if landingpage != 'workout_upload_view':
|
if landingpage != 'workout_upload_view':
|
||||||
url = reverse(landingpage,
|
url = reverse(landingpage,
|
||||||
@@ -11725,7 +11764,8 @@ def workout_upload_view(request,
|
|||||||
uploadoptions['upload_to_MapMyFitness'] = True
|
uploadoptions['upload_to_MapMyFitness'] = True
|
||||||
|
|
||||||
form = DocumentsForm(initial=docformoptions)
|
form = DocumentsForm(initial=docformoptions)
|
||||||
optionsform = UploadOptionsForm(initial=uploadoptions)
|
optionsform = UploadOptionsForm(initial=uploadoptions,
|
||||||
|
request=request)
|
||||||
return render(request, 'document_form.html',
|
return render(request, 'document_form.html',
|
||||||
{'form':form,
|
{'form':form,
|
||||||
'active':'nav-workouts',
|
'active':'nav-workouts',
|
||||||
@@ -16111,11 +16151,32 @@ def virtualevent_disqualify_view(request,raceid=0,recordid=0):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
buttons = []
|
||||||
|
|
||||||
|
if not request.user.is_anonymous():
|
||||||
|
if race_can_register(r,race):
|
||||||
|
buttons += ['registerbutton']
|
||||||
|
|
||||||
|
if race_can_adddiscipline(r,race):
|
||||||
|
buttons += ['adddisciplinebutton']
|
||||||
|
|
||||||
|
if race_can_submit(r,race):
|
||||||
|
buttons += ['submitbutton']
|
||||||
|
|
||||||
|
if race_can_resubmit(r,race):
|
||||||
|
buttons += ['resubmitbutton']
|
||||||
|
|
||||||
|
if race_can_withdraw(r,race):
|
||||||
|
buttons += ['withdrawbutton']
|
||||||
|
|
||||||
|
if race_can_edit(r,race):
|
||||||
|
buttons += ['editbutton']
|
||||||
|
|
||||||
return render(request,"disqualification_view.html",
|
return render(request,"disqualification_view.html",
|
||||||
{'workout':workout,
|
{'workout':workout,
|
||||||
'active':'nav-racing',
|
'active':'nav-racing',
|
||||||
'graphs':g,
|
'graphs':g,
|
||||||
|
'buttons':buttons,
|
||||||
'interactiveplot':script,
|
'interactiveplot':script,
|
||||||
'the_div':div,
|
'the_div':div,
|
||||||
'mapscript':mapscript,
|
'mapscript':mapscript,
|
||||||
@@ -16453,10 +16514,31 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
buttons = []
|
||||||
|
|
||||||
|
if not request.user.is_anonymous():
|
||||||
|
if race_can_register(r,race):
|
||||||
|
buttons += ['registerbutton']
|
||||||
|
|
||||||
|
if race_can_adddiscipline(r,race):
|
||||||
|
buttons += ['adddisciplinebutton']
|
||||||
|
|
||||||
|
if race_can_submit(r,race):
|
||||||
|
buttons += ['submitbutton']
|
||||||
|
|
||||||
|
if race_can_resubmit(r,race):
|
||||||
|
buttons += ['resubmitbutton']
|
||||||
|
|
||||||
|
if race_can_withdraw(r,race):
|
||||||
|
buttons += ['withdrawbutton']
|
||||||
|
|
||||||
|
if race_can_edit(r,race):
|
||||||
|
buttons += ['editbutton']
|
||||||
|
|
||||||
return render(request,'virtualeventregister.html',
|
return render(request,'virtualeventregister.html',
|
||||||
{
|
{
|
||||||
'form':form,
|
'form':form,
|
||||||
|
'buttons':buttons,
|
||||||
'breadcrumbs':breadcrumbs,
|
'breadcrumbs':breadcrumbs,
|
||||||
'race':race,
|
'race':race,
|
||||||
'userid':r.user.id,
|
'userid':r.user.id,
|
||||||
@@ -16526,6 +16608,22 @@ def virtualevent_register_view(request,id=0):
|
|||||||
|
|
||||||
add_rower_race(r,race)
|
add_rower_race(r,race)
|
||||||
|
|
||||||
|
otherrecords = IndoorVirtualRaceResult.objects.filter(
|
||||||
|
race = race).exclude(userid = r.id)
|
||||||
|
|
||||||
|
for otherrecord in otherrecords:
|
||||||
|
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||||
|
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
||||||
|
registeredname = r.user.first_name+' '+r.user.last_name
|
||||||
|
if otherrecord.emailnotifications:
|
||||||
|
job = myqueue(
|
||||||
|
queue,
|
||||||
|
handle_sendemail_raceregistration,
|
||||||
|
otheruser.user.email, othername,
|
||||||
|
registeredname,
|
||||||
|
race.name,
|
||||||
|
race.id
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
messages.info(
|
messages.info(
|
||||||
@@ -16566,15 +16664,80 @@ def virtualevent_register_view(request,id=0):
|
|||||||
'name': 'Register'
|
'name': 'Register'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
buttons = []
|
||||||
|
|
||||||
|
if not request.user.is_anonymous():
|
||||||
|
if race_can_register(r,race):
|
||||||
|
buttons += ['registerbutton']
|
||||||
|
|
||||||
|
if race_can_adddiscipline(r,race):
|
||||||
|
buttons += ['adddisciplinebutton']
|
||||||
|
|
||||||
|
if race_can_submit(r,race):
|
||||||
|
buttons += ['submitbutton']
|
||||||
|
|
||||||
|
if race_can_resubmit(r,race):
|
||||||
|
buttons += ['resubmitbutton']
|
||||||
|
|
||||||
|
if race_can_withdraw(r,race):
|
||||||
|
buttons += ['withdrawbutton']
|
||||||
|
|
||||||
|
if race_can_edit(r,race):
|
||||||
|
buttons += ['editbutton']
|
||||||
|
|
||||||
return render(request,'virtualeventregister.html',
|
return render(request,'virtualeventregister.html',
|
||||||
{
|
{
|
||||||
'form':form,
|
'form':form,
|
||||||
|
'buttons':buttons,
|
||||||
'breadcrumbs':breadcrumbs,
|
'breadcrumbs':breadcrumbs,
|
||||||
'race':race,
|
'race':race,
|
||||||
'userid':r.user.id,
|
'userid':r.user.id,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@login_required()
|
||||||
|
def virtualevent_toggle_email_view(request,id=0):
|
||||||
|
r = getrower(request.user)
|
||||||
|
race = VirtualRace.objects.get(id=id)
|
||||||
|
records = VirtualRaceResult.objects.filter(userid=r.id,race=race)
|
||||||
|
|
||||||
|
if True in [record.emailnotifications for record in records]:
|
||||||
|
newsetting = False
|
||||||
|
else:
|
||||||
|
newsetting = True
|
||||||
|
|
||||||
|
for record in records:
|
||||||
|
record.emailnotifications = newsetting
|
||||||
|
record.save()
|
||||||
|
|
||||||
|
url = reverse(virtualevent_view,
|
||||||
|
kwargs={'id':record.race.id})
|
||||||
|
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
|
@login_required()
|
||||||
|
def indoorvirtualevent_toggle_email_view(request,id=0):
|
||||||
|
r = getrower(request.user)
|
||||||
|
race = VirtualRace.objects.get(id=id)
|
||||||
|
|
||||||
|
records = IndoorVirtualRaceResult.objects.filter(userid=r.id,
|
||||||
|
race=race)
|
||||||
|
|
||||||
|
if True in [record.emailnotifications for record in records]:
|
||||||
|
newsetting = False
|
||||||
|
else:
|
||||||
|
newsetting = True
|
||||||
|
|
||||||
|
for record in records:
|
||||||
|
record.emailnotifications = newsetting
|
||||||
|
record.save()
|
||||||
|
|
||||||
|
url = reverse(virtualevent_view,
|
||||||
|
kwargs={'id':record.race.id})
|
||||||
|
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
@login_required()
|
@login_required()
|
||||||
def indoorvirtualevent_register_view(request,id=0):
|
def indoorvirtualevent_register_view(request,id=0):
|
||||||
r = getrower(request.user)
|
r = getrower(request.user)
|
||||||
@@ -16633,6 +16796,22 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
|
|
||||||
add_rower_race(r,race)
|
add_rower_race(r,race)
|
||||||
|
|
||||||
|
otherrecords = IndoorVirtualRaceResult.objects.filter(
|
||||||
|
race = race).exclude(userid = r.id)
|
||||||
|
|
||||||
|
for otherrecord in otherrecords:
|
||||||
|
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||||
|
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
||||||
|
registeredname = r.user.first_name+' '+r.user.last_name
|
||||||
|
if otherrecord.emailnotifications:
|
||||||
|
job = myqueue(
|
||||||
|
queue,
|
||||||
|
handle_sendemail_raceregistration,
|
||||||
|
otheruser.user.email, othername,
|
||||||
|
registeredname,
|
||||||
|
race.name,
|
||||||
|
race.id
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
messages.info(
|
messages.info(
|
||||||
@@ -16674,9 +16853,31 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
buttons = []
|
||||||
|
|
||||||
|
if not request.user.is_anonymous():
|
||||||
|
if race_can_register(r,race):
|
||||||
|
buttons += ['registerbutton']
|
||||||
|
|
||||||
|
if race_can_adddiscipline(r,race):
|
||||||
|
buttons += ['adddisciplinebutton']
|
||||||
|
|
||||||
|
if race_can_submit(r,race):
|
||||||
|
buttons += ['submitbutton']
|
||||||
|
|
||||||
|
if race_can_resubmit(r,race):
|
||||||
|
buttons += ['resubmitbutton']
|
||||||
|
|
||||||
|
if race_can_withdraw(r,race):
|
||||||
|
buttons += ['withdrawbutton']
|
||||||
|
|
||||||
|
if race_can_edit(r,race):
|
||||||
|
buttons += ['editbutton']
|
||||||
|
|
||||||
return render(request,'virtualeventregister.html',
|
return render(request,'virtualeventregister.html',
|
||||||
{
|
{
|
||||||
'form':form,
|
'form':form,
|
||||||
|
'buttons':buttons,
|
||||||
'race':race,
|
'race':race,
|
||||||
'breadcrumbs':breadcrumbs,
|
'breadcrumbs':breadcrumbs,
|
||||||
'userid':r.user.id,
|
'userid':r.user.id,
|
||||||
@@ -17024,10 +17225,32 @@ def virtualevent_edit_view(request,id=0):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
buttons = []
|
||||||
|
|
||||||
|
if not request.user.is_anonymous():
|
||||||
|
if race_can_register(r,race):
|
||||||
|
buttons += ['registerbutton']
|
||||||
|
|
||||||
|
if race_can_adddiscipline(r,race):
|
||||||
|
buttons += ['adddisciplinebutton']
|
||||||
|
|
||||||
|
if race_can_submit(r,race):
|
||||||
|
buttons += ['submitbutton']
|
||||||
|
|
||||||
|
if race_can_resubmit(r,race):
|
||||||
|
buttons += ['resubmitbutton']
|
||||||
|
|
||||||
|
if race_can_withdraw(r,race):
|
||||||
|
buttons += ['withdrawbutton']
|
||||||
|
|
||||||
|
if race_can_edit(r,race):
|
||||||
|
buttons += ['editbutton']
|
||||||
|
|
||||||
return render(request,'virtualeventedit.html',
|
return render(request,'virtualeventedit.html',
|
||||||
{
|
{
|
||||||
'form':racecreateform,
|
'form':racecreateform,
|
||||||
'breadcrumbs':breadcrumbs,
|
'breadcrumbs':breadcrumbs,
|
||||||
|
'buttons':buttons,
|
||||||
'rower':r,
|
'rower':r,
|
||||||
'race':race,
|
'race':race,
|
||||||
|
|
||||||
@@ -17100,9 +17323,33 @@ def indoorvirtualevent_edit_view(request,id=0):
|
|||||||
'name': 'Edit'
|
'name': 'Edit'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
buttons = []
|
||||||
|
|
||||||
|
if not request.user.is_anonymous():
|
||||||
|
if race_can_register(r,race):
|
||||||
|
buttons += ['registerbutton']
|
||||||
|
|
||||||
|
if race_can_adddiscipline(r,race):
|
||||||
|
buttons += ['adddisciplinebutton']
|
||||||
|
|
||||||
|
if race_can_submit(r,race):
|
||||||
|
buttons += ['submitbutton']
|
||||||
|
|
||||||
|
if race_can_resubmit(r,race):
|
||||||
|
buttons += ['resubmitbutton']
|
||||||
|
|
||||||
|
if race_can_withdraw(r,race):
|
||||||
|
buttons += ['withdrawbutton']
|
||||||
|
|
||||||
|
if race_can_edit(r,race):
|
||||||
|
buttons += ['editbutton']
|
||||||
|
|
||||||
|
|
||||||
return render(request,'virtualeventedit.html',
|
return render(request,'virtualeventedit.html',
|
||||||
{
|
{
|
||||||
'form':racecreateform,
|
'form':racecreateform,
|
||||||
|
'buttons':buttons,
|
||||||
'breadcrumbs':breadcrumbs,
|
'breadcrumbs':breadcrumbs,
|
||||||
'rower':r,
|
'rower':r,
|
||||||
'race':race,
|
'race':race,
|
||||||
@@ -17142,6 +17389,7 @@ def virtualevent_submit_result_view(request,id=0):
|
|||||||
race=race
|
race=race
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
entrychoices = []
|
entrychoices = []
|
||||||
|
|
||||||
for record in records:
|
for record in records:
|
||||||
@@ -17234,6 +17482,25 @@ def virtualevent_submit_result_view(request,id=0):
|
|||||||
request.session['async_tasks'] = [(jobid,'submit_race')]
|
request.session['async_tasks'] = [(jobid,'submit_race')]
|
||||||
|
|
||||||
messages.info(request,"We are evaluating your result. The page will reload when we're done. Your result will show up if you adhered to the course")
|
messages.info(request,"We are evaluating your result. The page will reload when we're done. Your result will show up if you adhered to the course")
|
||||||
|
|
||||||
|
if result:
|
||||||
|
otherrecords = resultobj.objects.filter(
|
||||||
|
race = race).exclude(userid = r.id)
|
||||||
|
|
||||||
|
for otherrecord in otherrecords:
|
||||||
|
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||||
|
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
||||||
|
registeredname = r.user.first_name+' '+r.user.last_name
|
||||||
|
if otherrecord.emailnotifications:
|
||||||
|
job = myqueue(
|
||||||
|
queue,
|
||||||
|
handle_sendemail_racesubmission,
|
||||||
|
otheruser.user.email, othername,
|
||||||
|
registeredname,
|
||||||
|
race.name,
|
||||||
|
race.id
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# redirect to race page
|
# redirect to race page
|
||||||
url = reverse(virtualevent_view,
|
url = reverse(virtualevent_view,
|
||||||
@@ -17264,9 +17531,33 @@ def virtualevent_submit_result_view(request,id=0):
|
|||||||
'name': 'Submit Result'
|
'name': 'Submit Result'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
buttons = []
|
||||||
|
|
||||||
|
if not request.user.is_anonymous():
|
||||||
|
if race_can_register(r,race):
|
||||||
|
buttons += ['registerbutton']
|
||||||
|
|
||||||
|
if race_can_adddiscipline(r,race):
|
||||||
|
buttons += ['adddisciplinebutton']
|
||||||
|
|
||||||
|
if race_can_submit(r,race):
|
||||||
|
buttons += ['submitbutton']
|
||||||
|
|
||||||
|
if race_can_resubmit(r,race):
|
||||||
|
buttons += ['resubmitbutton']
|
||||||
|
|
||||||
|
if race_can_withdraw(r,race):
|
||||||
|
buttons += ['withdrawbutton']
|
||||||
|
|
||||||
|
if race_can_edit(r,race):
|
||||||
|
buttons += ['editbutton']
|
||||||
|
|
||||||
|
|
||||||
return render(request,'race_submit.html',
|
return render(request,'race_submit.html',
|
||||||
{
|
{
|
||||||
'race':race,
|
'race':race,
|
||||||
|
'buttons':buttons,
|
||||||
'workouts':ws,
|
'workouts':ws,
|
||||||
'breadcrumbs':breadcrumbs,
|
'breadcrumbs':breadcrumbs,
|
||||||
'active':'nav-racing',
|
'active':'nav-racing',
|
||||||
|
|||||||
Reference in New Issue
Block a user