182 lines
5.6 KiB
HTML
182 lines
5.6 KiB
HTML
{% extends "newbase.html" %}
|
|
{% load static %}
|
|
{% load rowerfilters %}
|
|
|
|
{% block title %}Rowsandall {% endblock %}
|
|
|
|
{% block main %}
|
|
<div id="id_js_res">
|
|
<script src="https://d3js.org/d3.v7.min.js"></script>
|
|
</div>
|
|
|
|
|
|
<div id="id_script">
|
|
</div>
|
|
|
|
|
|
<div id="activities_script">
|
|
</div>
|
|
|
|
<ul class="main-content">
|
|
<li class="grid_2">
|
|
<h1>History for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
|
</li>
|
|
<li class="grid_2">
|
|
<a href="/rowers/history/?enddate={{ today|date:"Y-m-d" }}&startdate={{ lastseven|date:"Y-m-d" }}&workouttype={{ workouttype }}">Past 7 days</a>
|
|
|
|
<a href="/rowers/history/?enddate={{ today|date:"Y-m-d" }}&startdate={{ lastfourteen|date:"Y-m-d" }}&workouttype={{ workouttype }}">Past 14 days</a>
|
|
|
|
<a href="/rowers/history/?enddate={{ today|date:"Y-m-d" }}&startdate={{ last28|date:"Y-m-d" }}&workouttype={{ workouttype }}">Past 28 days</a>
|
|
|
|
<a href="/rowers/history/?enddate={{ today|date:"Y-m-d" }}&startdate={{ firstmay|date:"Y-m-d" }}&workouttype={{ workouttype }}">Current Concept2 Season</a>
|
|
|
|
<a href="/rowers/history/?enddate={{ today|date:"Y-m-d" }}&startdate={{ lastyear|date:"Y-m-d" }}&workouttype={{ workouttype }}">Past 12 months</a>
|
|
</li>
|
|
<li class="grid_2">
|
|
<p>
|
|
<form enctype="multipart/form-data" method="get">
|
|
<table>
|
|
{{ form.as_table }}
|
|
</table>
|
|
<input type="submit" value="Submit"/>
|
|
</form>
|
|
</p>
|
|
</li>
|
|
<li class="grid_2">
|
|
<h2>All workouts</h2>
|
|
|
|
<p>
|
|
<table class="listtable shortpadded">
|
|
<tbody>
|
|
<tr>
|
|
<td>Total Distance</td><td>{{ totalsdict|lookup:"distance"}} meters</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Total Duration</td><td>{{ totalsdict|lookup:"duration"}} </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Number of workouts</td><td>{{ totalsdict|lookup:"nrworkouts"}}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Average heart rate</td><td><span id="total_hr"></span> bpm</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Maximum heart rate</td><td><span id="total_maxhr"></span> bpm</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Average power</td><td><span id="total_power"></span> W</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Maximum power</td><td><span id="total_maxpower"></span> W</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</p>
|
|
</li>
|
|
<li class="grid_2">
|
|
<div id="id_activities">
|
|
</div>
|
|
</li>
|
|
<li class="grid_2">
|
|
{{ tdiv|safe }}
|
|
<div id="t_script">
|
|
{{ tscript|safe}}
|
|
</div>
|
|
|
|
</li>
|
|
<li class="grid_2">
|
|
<div id="id_chart">
|
|
{{ totaldiv|safe }}
|
|
</div>
|
|
</li>
|
|
|
|
{% for ddict in typedicts %}
|
|
<li class="grid_1">
|
|
<h2>{{ ddict|lookup:"wtype"}}</h2>
|
|
|
|
<p>
|
|
<table class="listtable shortpadded">
|
|
<tbody>
|
|
<tr>
|
|
<td>Total Distance</td><td>{{ ddict|lookup:"distance"}} meters</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Total Duration</td><td>{{ ddict|lookup:"duration"}} </td>
|
|
</tr>
|
|
<tr>
|
|
<td>Number of workouts</td><td>{{ ddict|lookup:"nrworkouts"}}</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Average heart rate</td><td><span id="{{ ddict|lookup:'id'}}_hr"></span> bpm</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Maximum heart rate</td><td><span id="{{ ddict|lookup:'id' }}_hrmax"></span> bpm</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Average power</td><td><span id="{{ ddict|lookup:'id'}}_power"></span> W</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Maximum power</td><td><span id="{{ ddict|lookup:'id'}}_powermax"></span> W</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</p>
|
|
</li>
|
|
|
|
{% endfor %}
|
|
</ul>
|
|
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script type='text/javascript'
|
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
|
</script>
|
|
|
|
<script>
|
|
$(function($) {
|
|
console.log('loading script for chart');
|
|
var ed = '{{ senddate|date:"Y-m-d" }}'
|
|
console.log('End',ed);
|
|
console.log(window.location.protocol + '//'+window.location.host + '/rowers/history/user/{{ rower.user.id }}/data/?startdate={{ sstartdate|date:"Y-m-d" }}&enddate={{ senddate|date:"Y-m-d" }}&workouttype={{ workouttype }}&yaxis={{ yaxis }}')
|
|
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/history/user/{{ rower.user.id }}/data/?startdate={{ sstartdate|date:"Y-m-d" }}&enddate={{ senddate|date:"Y-m-d" }}&workouttype={{ workouttype }}&yaxis={{ yaxis }}', function(json) {
|
|
|
|
|
|
var script = json.script;
|
|
var div = json.div;
|
|
var totalsdict = json.totalsdict
|
|
var listofdicts = json.listofdicts
|
|
var activities_script = json.activities_script
|
|
var activities_chart = json.activities_chart
|
|
$("#id_sitready").remove();
|
|
$("#id_chart").append(div);
|
|
$("#id_script").append(script);
|
|
$("#id_activities").append(activities_chart)
|
|
$("#activities_script").append(activities_script)
|
|
$("#total_hr").append(totalsdict.hrmean);
|
|
$("#total_maxhr").append(totalsdict.hrmax);
|
|
$("#total_power").append(totalsdict.powermean);
|
|
$("#total_maxpower").append(totalsdict.powermax);
|
|
$("#selectors").hide();
|
|
|
|
listofdicts.forEach(function(item){
|
|
var id = "#"+item.id+"_hr";
|
|
$(id).append(item.hrmean);
|
|
id = "#"+item.id+"_hrmax";
|
|
$(id).append(item.hrmax);
|
|
id = "#"+item.id+"_power";
|
|
$(id).append(item.powermean);
|
|
id = "#"+item.id+"_powermax";
|
|
$(id).append(item.powermax);
|
|
})
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block sidebar %}
|
|
{% include 'menu_analytics.html' %}
|
|
{% endblock %}
|