checking race course message linking to job status
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
{% include "monitorjobs.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}{{ workout.name }} {% endblock %}
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
<h1>{{ workout.name }}</h1>
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
{% if records %}
|
||||
<li class="grid_4">
|
||||
<h2>Course Results</h2>
|
||||
@@ -48,6 +47,33 @@
|
||||
</table>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if courses %}
|
||||
<li>
|
||||
<h1>Interval by Course</h1>
|
||||
<p>
|
||||
This functionality allows you to record a time on a set course that you've rowed during the workout.
|
||||
The summary will be updated to show time on course, and you can compare this with other
|
||||
attempts.
|
||||
</p>
|
||||
<p>
|
||||
{% if rower.share_course_results %}
|
||||
You are currently sharing your course results with all Rowsandall users.
|
||||
Click <a href="/rowers/me/edit/?courseshare=false">here</a> to hide your course results.
|
||||
{% else %}
|
||||
You are currently hiding your course results (except for your participation in online challenges).
|
||||
Click <a href="/rowers/me/edit/?courseshare=true">here</a> to hide your course results.
|
||||
{% endif %}
|
||||
</p>
|
||||
<form ecntype="multipart/form-data" method="post">
|
||||
<table>
|
||||
{{ courseselectform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<input class="button" type="submit" value="Select Course">
|
||||
</form>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="grid_2">
|
||||
<table width=100%>
|
||||
<tr>
|
||||
<th>Rower:</th><td>{{ first_name }} {{ last_name }}</td>
|
||||
|
||||
@@ -765,6 +765,7 @@ verbose_job_status = {
|
||||
'long_test_task2': 'Long Test Task 2',
|
||||
'update_empower': 'Correct Empower Inflated Power Bug',
|
||||
'submit_race': 'Checking Race Course Result',
|
||||
'check_race_course': 'Checking Course Result',
|
||||
}
|
||||
|
||||
def get_job_status(jobid): # pragma: no cover
|
||||
|
||||
@@ -6088,13 +6088,63 @@ def workout_course_view(request, id):
|
||||
strict=True)
|
||||
courseselectform = CourseSelectForm(choices=courses)
|
||||
|
||||
|
||||
|
||||
if request.method == 'POST':
|
||||
courseselectform = CourseSelectForm(request.POST,choices=courses)
|
||||
if courseselectform.is_valid():
|
||||
course = courseselectform.cleaned_data['course']
|
||||
# get or create a record
|
||||
records = VirtualRaceResult.objects.filter(
|
||||
userid=r.id,
|
||||
course=course,
|
||||
workoutid=row.id
|
||||
)
|
||||
if records:
|
||||
record = records[0]
|
||||
else:
|
||||
# create record
|
||||
record = VirtualRaceResult(
|
||||
userid = r.id,
|
||||
username = r.user.first_name+' '+r.user.last_name,
|
||||
workoutid = row.id,
|
||||
weightcategory = r.weightcategory,
|
||||
adaptiveclass = r.adaptiveclass,
|
||||
course = course,
|
||||
distance = course.distance,
|
||||
boatclass = row.workouttype,
|
||||
boattype = row.boattype,
|
||||
sex = r.sex,
|
||||
age = calculate_age(r.birthdate),
|
||||
)
|
||||
record.save()
|
||||
|
||||
job = myqueue(
|
||||
queuehigh,
|
||||
handle_check_race_course,
|
||||
row.csvfilename,
|
||||
row.id,
|
||||
course.id,
|
||||
record.id,
|
||||
r.user.email,
|
||||
r.user.first_name,
|
||||
summary=True,
|
||||
successemail=True,
|
||||
)
|
||||
|
||||
try:
|
||||
request.session['async_tasks'] += [(job.id,'check_race_course')]
|
||||
except KeyError:
|
||||
request.session['async_tasks'] = [(job.id,'check_race_course')]
|
||||
|
||||
messages.info(request,'We are checking your time on the course in the background. You will receive an email when the check is complete. You can check the status <a href="/rowers/jobs-status/" target="_blank">here</a>')
|
||||
|
||||
# get results
|
||||
records = VirtualRaceResult.objects.filter(
|
||||
course__isnull=False,
|
||||
workoutid=row.id,
|
||||
coursecompleted=True).order_by("duration","-distance")
|
||||
|
||||
|
||||
return render(request, 'workout_courses.html',
|
||||
{'workout':row,
|
||||
'rower':r,
|
||||
@@ -6277,7 +6327,13 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
summary=True,
|
||||
successemail=True,
|
||||
)
|
||||
messages.info(request,'We are checking your time on the course in the background')
|
||||
|
||||
try:
|
||||
request.session['async_tasks'] += [(job.id,'check_race_course')]
|
||||
except KeyError:
|
||||
request.session['async_tasks'] = [(job.id,'check_race_course')]
|
||||
|
||||
messages.info(request,'We are checking your time on the course in the background. You will receive an email when the check is complete. You can check the status <a href="/rowers/jobs-status/" target="_blank">here</a>')
|
||||
|
||||
vals = None
|
||||
# feeling lucky / ruptures
|
||||
|
||||
Reference in New Issue
Block a user