team stats page
This commit is contained in:
@@ -33,55 +33,59 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div id="workouts_table" class="grid_8 alpha">
|
||||
{% if team %}
|
||||
<div class="grid_8 alpha">
|
||||
{% include "teambuttons.html" with teamid=team.id %}
|
||||
</div>
|
||||
<h3>{{ team.name }} Team Workouts</h3>
|
||||
{% else %}
|
||||
<h3>My Workouts</h3>
|
||||
{% endif %}
|
||||
{% if team %}
|
||||
<div class="grid_12 alpha">
|
||||
{% include "teambuttons.html" with teamid=team.id team=team %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if workouts %}
|
||||
<table width="100%" class="listtable shortpadded">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:80px"> Date</th>
|
||||
<th> Time</th>
|
||||
<th> Name</th>
|
||||
<th> Type</th>
|
||||
<th> Distance </th>
|
||||
<th> Duration </th>
|
||||
<th> Avg HR </th>
|
||||
<th> Max HR </th>
|
||||
{% if not team %}
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
{% else %}
|
||||
<th colspan="2">
|
||||
Owner
|
||||
</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
<div class="grid_12">
|
||||
<div id="workouts_table" class="grid_8 alpha">
|
||||
{% if team %}
|
||||
<h3>{{ team.name }} Team Workouts</h3>
|
||||
{% else %}
|
||||
<h3>My Workouts</h3>
|
||||
{% endif %}
|
||||
|
||||
{% if workouts %}
|
||||
<table width="100%" class="listtable shortpadded">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:80px"> Date</th>
|
||||
<th> Time</th>
|
||||
<th> Name</th>
|
||||
<th> Type</th>
|
||||
<th> Distance </th>
|
||||
<th> Duration </th>
|
||||
<th> Avg HR </th>
|
||||
<th> Max HR </th>
|
||||
{% if not team %}
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
{% else %}
|
||||
<th colspan="2">
|
||||
Owner
|
||||
</th>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for workout in workouts %}
|
||||
<tr>
|
||||
<td> {{ workout.date |truncatechars:15}} </td>
|
||||
<td> {{ workout.starttime }} </td>
|
||||
<td>
|
||||
{% if workout.user.user == user or user == team.manager %}
|
||||
{% if workout.name != '' %}
|
||||
<a href="/rowers/workout/{{ workout.id }}/edit">{{ workout.name }}</a> </td>
|
||||
{% else %}
|
||||
<a href="/rowers/workout/{{ workout.id }}/edit">No Name</a> </td>
|
||||
<tbody>
|
||||
{% for workout in workouts %}
|
||||
<tr>
|
||||
<td> {{ workout.date |truncatechars:15}} </td>
|
||||
<td> {{ workout.starttime }} </td>
|
||||
<td>
|
||||
{% if workout.user.user == user or user == team.manager %}
|
||||
{% if workout.name != '' %}
|
||||
<a href="/rowers/workout/{{ workout.id }}/edit">{{ workout.name }}</a> </td>
|
||||
{% else %}
|
||||
<a href="/rowers/workout/{{ workout.id }}/edit">No Name</a> </td>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if workout.name != '' %}
|
||||
<a href="/rowers/workout/{{ workout.id }}/">{{ workout.name }}</a> </td>
|
||||
{% else %}
|
||||
<a href="/rowers/workout/{{ workout.id }}/">No Name</a> </td>
|
||||
{% if workout.name != '' %}
|
||||
<a href="/rowers/workout/{{ workout.id }}/">{{ workout.name }}</a> </td>
|
||||
{% else %}
|
||||
<a href="/rowers/workout/{{ workout.id }}/">No Name</a> </td>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<td> {{ workout.workouttype }} </td>
|
||||
@@ -114,6 +118,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
<div class="grid_4 omega">
|
||||
{% if team %}
|
||||
<div class="grid_4" id="teambuttons">
|
||||
@@ -152,7 +157,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="grid_5 alpha">
|
||||
|
||||
@@ -34,11 +34,12 @@
|
||||
</style>
|
||||
|
||||
|
||||
<div class="grid_12 alpha">
|
||||
{% include "teambuttons.html" with teamid=teamid team=team %}
|
||||
</div>
|
||||
<div class="grid_12">
|
||||
<div id="workouts" class="grid_8 alpha">
|
||||
<h1>Interactive Comparison</h1>
|
||||
<div class="grid_8 alpha">
|
||||
{% include "teambuttons.html" with teamid=teamid%}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_4 omega">
|
||||
<form enctype="multipart/form-data" action="/rowers/multi-compare" method="post">
|
||||
@@ -53,6 +54,7 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
{% block title %}Team {% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="grid_12 alpha">
|
||||
<h1>{{ team.name }}</h1>
|
||||
<div class="grid_8 alpha">
|
||||
<div class="grid_12 alpha">
|
||||
{% include "teambuttons.html" with teamid=team.id %}
|
||||
</div>
|
||||
<div class="grid_12">
|
||||
<div class="grid_8 alpha">
|
||||
<h1>{{ team.name }}</h1>
|
||||
|
||||
<div class="grid_4 omega">
|
||||
<p>{{ team.notes }}</p>
|
||||
<p><b>Manager:</b> {{ team.manager.first_name }} {{ team.manager.last_name }}</p>
|
||||
@@ -90,7 +92,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
|
||||
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_8 suffix_4 alpha">
|
||||
{% include "teambuttons.html" with teamid=team.id %}
|
||||
</div>
|
||||
{% include "teambuttons.html" with teamid=team.id team=team %}
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<h3>{{ team.name }} Team Workouts</h3>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<a class="button gray small" href="/rowers/team/{{ teamid }}/">Team Page</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<div class="grid_2">
|
||||
{% if user|is_manager and user|has_teams %}
|
||||
<p>
|
||||
<a class="button gray small" href="/rowers/workout/upload/team/">Upload Workout</a>
|
||||
@@ -23,3 +23,14 @@
|
||||
<p> </p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
{% if team and team.manager == user %}
|
||||
<p>
|
||||
<a class="button gray small" href="/rowers/team/{{ teamid }}/memberstats">
|
||||
Team Stats
|
||||
</a>
|
||||
</p>
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
33
rowers/templates/teamstats.html
Normal file
33
rowers/templates/teamstats.html
Normal file
@@ -0,0 +1,33 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Team {% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="grid_12 alpha">
|
||||
{% include "teambuttons.html" with teamid=team.id team=team %}
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<h1>{{ team.name }} Stats</h1>
|
||||
<p>
|
||||
Links to the cumulative statistics pages for your team's members
|
||||
</p>
|
||||
<table width="70%" class="listtable shortpadded">
|
||||
<tbody>
|
||||
{% for u in theusers %}
|
||||
<tr>
|
||||
<td>{{ u.first_name }} {{ u.last_name }}</td>
|
||||
<td><a href="/rowers/{{ u.id }}/ote-bests">Ranking Pieces</a></td>
|
||||
<td><a href="/rowers/flexall/u/{{ u.id }}">Stroke Analysis</a></td>
|
||||
<td><a href="/rowers/histo/u/{{ u.id }}">Power Histogram</a></td>
|
||||
<td><a href="/rowers/cumstats/u/{{ u.id }}">Stats</a></td>
|
||||
<td><a href="/rowers/user-boxplot-select/user/{{ u.id }}/">Box Chart</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -7,11 +7,11 @@
|
||||
{% block content %}
|
||||
|
||||
|
||||
{% if team %}
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_8 suffix_4 alpha">
|
||||
{% include "teambuttons.html" with teamid=team.id %}
|
||||
</div>
|
||||
{% include "teambuttons.html" with teamid=team.id team=team %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_4 alpha">
|
||||
{% if theuser %}
|
||||
@@ -20,7 +20,7 @@
|
||||
<h3>{{ user.first_name }}'s Workouts</h3>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="grid_2 suffix_6 omega">
|
||||
<div class="grid_2 prefix_6 omega">
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
<div class="grid_2 alpha dropdown">
|
||||
<button class="grid_2 alpha button green small dropbtn">
|
||||
|
||||
@@ -140,11 +140,14 @@ urlpatterns = [
|
||||
url(r'^flexall/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)$',views.cum_flex),
|
||||
url(r'^flexall/$',views.cum_flex),
|
||||
|
||||
url(r'^histo/u/(?P<theuser>\d+)$',views.histo),
|
||||
url(r'^flexall/u/(?P<theuser>\d+)$',views.cum_flex),
|
||||
url(r'^(?P<theuser>\d+)/histo/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.histo),
|
||||
url(r'^(?P<theuser>\d+)/histo/(?P<deltadays>\d+)$',views.histo),
|
||||
url(r'^histo/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.histo),
|
||||
url(r'^histo/(?P<deltadays>\d+)$',views.histo),
|
||||
url(r'^histo/$',views.histo),
|
||||
url(r'^cumstats/u/(?P<theuser>\d+)$',views.cumstats),
|
||||
url(r'^cumstats/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)/p/(?P<plotfield>\w+.*)$',views.cumstats),
|
||||
url(r'^(?P<theuser>\d+)/cumstats/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)/p/(?P<plotfield>\w+.*)$',views.cumstats),
|
||||
url(r'^(?P<theuser>\d+)/cumstats/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.cumstats),
|
||||
@@ -227,6 +230,7 @@ urlpatterns = [
|
||||
url(r'^user-boxplot$',views.boxplot_view),
|
||||
url(r'^me/teams/$',views.rower_teams_view),
|
||||
url(r'^team/(?P<id>\d+)/$',views.team_view),
|
||||
url(r'^team/(?P<id>\d+)/memberstats$',views.team_members_stats_view),
|
||||
url(r'^team/(?P<id>\d+)/edit$',views.team_edit_view),
|
||||
url(r'^team/(?P<id>\d+)/leaveconfirm/$',views.team_leaveconfirm_view),
|
||||
url(r'^team/(?P<id>\d+)/leave/$',views.team_leave_view),
|
||||
|
||||
@@ -2004,8 +2004,8 @@ def cum_flex(request,theuser=0,
|
||||
if result:
|
||||
promember=1
|
||||
|
||||
if not promember:
|
||||
return HttpResponseRedirect("/rowers/about/")
|
||||
#if not promember:
|
||||
#return HttpResponseRedirect("/rowers/about/")
|
||||
|
||||
# get all indoor rows of in date range
|
||||
|
||||
@@ -7706,3 +7706,28 @@ def team_delete_view(request,id):
|
||||
url = reverse(rower_teams_view)
|
||||
response = HttpResponseRedirect(url)
|
||||
return response
|
||||
|
||||
@user_passes_test(iscoachmember,login_url="/",redirect_field_name=None)
|
||||
def team_members_stats_view(request,id):
|
||||
r = Rower.objects.get(user=request.user)
|
||||
try:
|
||||
t = Team.objects.get(id=id)
|
||||
except Team.DoesNotExist:
|
||||
raise Http404("This team doesn't exist")
|
||||
if t.manager != request.user:
|
||||
raise PermissionDenied("You are not allowed to see this page")
|
||||
|
||||
members = Rower.objects.filter(team=t).order_by("user__last_name","user__first_name")
|
||||
|
||||
theusers = [member.user for member in members]
|
||||
|
||||
|
||||
|
||||
response = render(request,'teamstats.html',
|
||||
{
|
||||
'teams':get_my_teams(request.user),
|
||||
'team':t,
|
||||
'theusers':theusers,
|
||||
})
|
||||
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user