workout histo
This commit is contained in:
@@ -803,7 +803,6 @@ def interactive_histoall(theworkouts):
|
|||||||
# add watermark
|
# add watermark
|
||||||
plot.extra_y_ranges = {"watermark": watermarkrange}
|
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||||
plot.extra_x_ranges = {"watermark": watermarkrange}
|
plot.extra_x_ranges = {"watermark": watermarkrange}
|
||||||
plot.sizing_mode = 'scale_width'
|
|
||||||
|
|
||||||
plot.image_url([watermarkurl],watermarkx,watermarky,
|
plot.image_url([watermarkurl],watermarkx,watermarky,
|
||||||
watermarkw,watermarkh,
|
watermarkw,watermarkh,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "newbase.html" %}
|
||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
{% load rowerfilters %}
|
{% load rowerfilters %}
|
||||||
|
|
||||||
{% block title %}View Workout {% endblock %}
|
{% block title %}View Workout {% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block main %}
|
||||||
|
|
||||||
<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>
|
||||||
<script async="true" type="text/javascript">
|
<script async="true" type="text/javascript">
|
||||||
@@ -13,54 +13,22 @@
|
|||||||
|
|
||||||
{{ interactiveplot |safe }}
|
{{ interactiveplot |safe }}
|
||||||
|
|
||||||
<script>
|
|
||||||
// Set things up to resize the plot on a window resize. You can play with
|
|
||||||
// the arguments of resize_width_height() to change the plot's behavior.
|
|
||||||
var plot_resize_setup = function () {
|
|
||||||
var plotid = Object.keys(Bokeh.index)[0]; // assume we have just one plot
|
|
||||||
var plot = Bokeh.index[plotid];
|
|
||||||
var plotresizer = function() {
|
|
||||||
// arguments: use width, use height, maintain aspect ratio
|
|
||||||
plot.resize_width_height(true, false, false);
|
|
||||||
};
|
|
||||||
window.addEventListener('resize', plotresizer);
|
|
||||||
plotresizer();
|
|
||||||
};
|
|
||||||
window.addEventListener('load', plot_resize_setup);
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
|
||||||
html, body {height: 100%; margin:5px;}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="navigation" class="grid_12 alpha">
|
|
||||||
{% if user.is_authenticated and mayedit %}
|
{% if user.is_authenticated and mayedit %}
|
||||||
<div class="grid_2 alpha">
|
|
||||||
<p>
|
|
||||||
<a class="button gray small" href="/rowers/workout/{{ id }}/edit">Edit Workout</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="grid_2 suffix_8 omega">
|
|
||||||
<p>
|
|
||||||
<a class="button gray small" href="/rowers/workout/{{ id }}/advanced">Advanced Edit</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="title" class="grid_12 alpha">
|
|
||||||
<h1>Indoor Rower Power Histogram</h1>
|
<h1>Indoor Rower Power Histogram</h1>
|
||||||
</div>
|
<ul class="main-content">
|
||||||
|
<li class="grid_4">
|
||||||
|
|
||||||
<div id="graph" class="grid_12 alpha">
|
|
||||||
|
|
||||||
{{ the_div|safe }}
|
{{ the_div|safe }}
|
||||||
|
|
||||||
</div>
|
</li>
|
||||||
|
</ul>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block sidebar %}
|
||||||
|
{% include 'menu_workouts.html' %}
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
@@ -2856,7 +2856,7 @@ def workout_test_task_view(request,id=0):
|
|||||||
# Show Stroke power histogram for a workout
|
# Show Stroke power histogram for a workout
|
||||||
@login_required()
|
@login_required()
|
||||||
def workout_histo_view(request,id=0):
|
def workout_histo_view(request,id=0):
|
||||||
row = get_workout(id)
|
w = get_workout(id)
|
||||||
|
|
||||||
promember=0
|
promember=0
|
||||||
mayedit=0
|
mayedit=0
|
||||||
@@ -2865,19 +2865,39 @@ def workout_histo_view(request,id=0):
|
|||||||
result = request.user.is_authenticated() and ispromember(request.user)
|
result = request.user.is_authenticated() and ispromember(request.user)
|
||||||
if result:
|
if result:
|
||||||
promember=1
|
promember=1
|
||||||
if request.user == row.user.user:
|
if request.user == w.user.user:
|
||||||
mayedit=1
|
mayedit=1
|
||||||
|
|
||||||
if not promember:
|
if not promember:
|
||||||
return HttpResponseRedirect("/rowers/about/")
|
return HttpResponseRedirect("/rowers/about/")
|
||||||
|
|
||||||
res = interactive_histoall([row])
|
res = interactive_histoall([w])
|
||||||
script = res[0]
|
script = res[0]
|
||||||
div = res[1]
|
div = res[1]
|
||||||
|
|
||||||
|
breadcrumbs = [
|
||||||
|
{
|
||||||
|
'url':'/rowers/list-workouts',
|
||||||
|
'name':'Workouts'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url':get_workout_default_page(request,id),
|
||||||
|
'name': str(w.id)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url':reverse(workout_histo_view,kwargs={'id':id}),
|
||||||
|
'name': 'Histogram'
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
return render(request,
|
return render(request,
|
||||||
'histo_single.html',
|
'histo_single.html',
|
||||||
{'interactiveplot':script,
|
{'interactiveplot':script,
|
||||||
|
'breadcrumbs':breadcrumbs,
|
||||||
|
'active':'nav-workouts',
|
||||||
|
'rower':r,
|
||||||
'the_div':div,
|
'the_div':div,
|
||||||
'id':int(id),
|
'id':int(id),
|
||||||
'mayedit':mayedit,
|
'mayedit':mayedit,
|
||||||
|
|||||||
Reference in New Issue
Block a user