expansion to workout_course page
This commit is contained in:
@@ -26,6 +26,18 @@
|
|||||||
<i class="fas fa-pause fa-fw"></i> Intervals
|
<i class="fas fa-pause fa-fw"></i> Intervals
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% if workout|water %}
|
||||||
|
<li id="workout-courses">
|
||||||
|
<a href="/rowers/workout/{{ workout.id|encode }}/courses/">
|
||||||
|
<i class="fas fa-route fa-fw"></i> Measured Courses
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
<li>
|
||||||
|
<a href="/rowers/workout/{{ workout.id|encode }}/editintervals/">
|
||||||
|
<i class="fas fa-pause fa-fw"></i> Intervals
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<li id="workout-comments">
|
<li id="workout-comments">
|
||||||
|
|||||||
79
rowers/templates/workout_courses.html
Normal file
79
rowers/templates/workout_courses.html
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
{% extends "newbase.html" %}
|
||||||
|
{% load static %}
|
||||||
|
{% load rowerfilters %}
|
||||||
|
{% load leaflet_tags %}
|
||||||
|
|
||||||
|
{% block meta %}
|
||||||
|
{% leaflet_js %}
|
||||||
|
{% leaflet_css %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block title %}{{ workout.name }} {% endblock %}
|
||||||
|
{% block og_title %}{{ workout.name }} {% endblock %}
|
||||||
|
{% block description %}{{ workout.name }}
|
||||||
|
{{ workout.date }} - {{ workout.distance }}m - {{ workout.duration |durationprint:"%H:%M:%S.%f" }}{% endblock %}
|
||||||
|
{% block og_description %}{{ workout.name }}
|
||||||
|
{{ workout.date }} - {{ workout.distance }}m - {{ workout.duration |durationprint:"%H:%M:%S.%f" }}{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% block main %}
|
||||||
|
|
||||||
|
<h1>{{ workout.name }}</h1>
|
||||||
|
<ul class="main-content">
|
||||||
|
<li class="grid_2">
|
||||||
|
{% if records %}
|
||||||
|
<li class="grid_4">
|
||||||
|
<h2>Course Results</h2>
|
||||||
|
<table class="listtable shortpadded">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Course</th>
|
||||||
|
<th>Time</th>
|
||||||
|
<th>Distance</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for record in records %}
|
||||||
|
<tr>
|
||||||
|
<td><a href="/rowers/courses/{{ record.course.id }}">{{ record.course.name }}</a></td>
|
||||||
|
<td>{{ record.duration |durationprint:"%H:%M:%S.%f" }}</td>
|
||||||
|
<td>{{ record.distance }} m</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
<table width=100%>
|
||||||
|
<tr>
|
||||||
|
<th>Rower:</th><td>{{ first_name }} {{ last_name }}</td>
|
||||||
|
</tr><tr>
|
||||||
|
<tr>
|
||||||
|
<th>Name:</th><td>{{ workout.name }}</td>
|
||||||
|
</tr><tr>
|
||||||
|
<tr>
|
||||||
|
<th>Date:</th><td>{{ workout.date }}</td>
|
||||||
|
</tr><tr>
|
||||||
|
<th>Time:</th><td>{{ workout.starttime }}</td>
|
||||||
|
</tr><tr>
|
||||||
|
<th>Distance:</th><td>{{ workout.distance }}m</td>
|
||||||
|
</tr><tr>
|
||||||
|
<th>Duration:</th><td>{{ workout.duration |durationprint:"%H:%M:%S.%f" }}</td>
|
||||||
|
</tr><tr>
|
||||||
|
<th>Type:</th><td>{{ workout.workouttype }}</td>
|
||||||
|
</tr><tr>
|
||||||
|
<th>Weight Category:</th><td>{{ workout.weightcategory }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block sidebar %}
|
||||||
|
{% include 'menu_workout.html' %}
|
||||||
|
{% endblock %}
|
||||||
@@ -650,6 +650,8 @@ urlpatterns = [
|
|||||||
re_path(r'^register/thankyou/$', TemplateView.as_view(template_name='registerthankyou.html'), name='registerthankyou'),
|
re_path(r'^register/thankyou/$', TemplateView.as_view(template_name='registerthankyou.html'), name='registerthankyou'),
|
||||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/workflow/$',views.workout_workflow_view,
|
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/workflow/$',views.workout_workflow_view,
|
||||||
name='workout_workflow_view'),
|
name='workout_workflow_view'),
|
||||||
|
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/courses/$',views.workout_course_view,
|
||||||
|
name='workout_course_view'),
|
||||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/flexchart/(?P<xparam>[\w\ ]+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)/(?P<plottype>\w+)/$',views.workout_flexchart3_view,name='workout_flexchart3_view'),
|
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/flexchart/(?P<xparam>[\w\ ]+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)/(?P<plottype>\w+)/$',views.workout_flexchart3_view,name='workout_flexchart3_view'),
|
||||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)/(?P<plottype>\w+.*)/$',views.workout_flexchart3_view,name='workout_flexchart3_view'),
|
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)/(?P<plottype>\w+.*)/$',views.workout_flexchart3_view,name='workout_flexchart3_view'),
|
||||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)/$',views.workout_flexchart3_view,name='workout_flexchart3_view'),
|
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)/$',views.workout_flexchart3_view,name='workout_flexchart3_view'),
|
||||||
|
|||||||
@@ -6058,6 +6058,54 @@ def workout_fusion_view(request,id1=0,id2=1):
|
|||||||
'workout2':w2,
|
'workout2':w2,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# See attached courses
|
||||||
|
@login_required()
|
||||||
|
@permission_required('workout.change_workout',fn=get_workout_by_opaqueid, raise_exception=True)
|
||||||
|
def workout_course_view(request, id):
|
||||||
|
row = get_workout_by_opaqueid(request,id)
|
||||||
|
r = getrower(request.user)
|
||||||
|
breadcrumbs = [
|
||||||
|
{
|
||||||
|
'url':'/rowers/list-workouts/',
|
||||||
|
'name':'Workouts'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url':get_workout_default_page(request,encoder.encode_hex(row.id)),
|
||||||
|
'name': row.name
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url':reverse('workout_course_view',kwargs={'id':id}),
|
||||||
|
'name': 'Measured Courses'
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
courses = []
|
||||||
|
courseselecform = CourseSelectForm()
|
||||||
|
has_latlon,lat_mean,lon_mean = dataprep.workout_has_latlon(row.id)
|
||||||
|
if has_latlon:
|
||||||
|
courses = getnearestcourses([lat_mean,lon_mean],GeoCourse.objects.all(),whatisnear=25,
|
||||||
|
strict=True)
|
||||||
|
courseselectform = CourseSelectForm(choices=courses)
|
||||||
|
|
||||||
|
# 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,
|
||||||
|
'breadcrumbs':breadcrumbs,
|
||||||
|
'active':'nav-workouts',
|
||||||
|
'teams':get_my_teams(request.user),
|
||||||
|
'courses':courses,
|
||||||
|
'courseselectform':courseselectform,
|
||||||
|
'records':records,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
# Edit the splits/summary
|
# Edit the splits/summary
|
||||||
@login_required()
|
@login_required()
|
||||||
|
|||||||
Reference in New Issue
Block a user