toggle rest stroke buttons
This commit is contained in:
@@ -125,7 +125,7 @@ def tailwind(bearing,vwind,winddir):
|
|||||||
from rowers.dataprep import nicepaceformat,niceformat
|
from rowers.dataprep import nicepaceformat,niceformat
|
||||||
from rowers.dataprep import timedeltaconv
|
from rowers.dataprep import timedeltaconv
|
||||||
|
|
||||||
def interactive_forcecurve(theworkouts):
|
def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
||||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
||||||
|
|
||||||
ids = [int(w.id) for w in theworkouts]
|
ids = [int(w.id) for w in theworkouts]
|
||||||
@@ -133,10 +133,21 @@ def interactive_forcecurve(theworkouts):
|
|||||||
boattype = theworkouts[0].boattype
|
boattype = theworkouts[0].boattype
|
||||||
|
|
||||||
columns = ['catch','slip','wash','finish','averageforce',
|
columns = ['catch','slip','wash','finish','averageforce',
|
||||||
'peakforceangle','peakforce','spm','distance']
|
'peakforceangle','peakforce','spm','distance',
|
||||||
|
'workoutstate']
|
||||||
|
|
||||||
rowdata = dataprep.getsmallrowdata_db(columns,ids=ids)
|
rowdata = dataprep.getsmallrowdata_db(columns,ids=ids)
|
||||||
|
|
||||||
|
workoutstateswork = [1,4,5,8,9,6,7]
|
||||||
|
workoutstatesrest = [3]
|
||||||
|
workoutstatetransition = [0,2,10,11,12,13]
|
||||||
|
|
||||||
|
if workstrokesonly:
|
||||||
|
try:
|
||||||
|
rowdata = rowdata[~rowdata['workoutstate'].isin(workoutstatesrest)]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
catchav = rowdata['catch'].mean()
|
catchav = rowdata['catch'].mean()
|
||||||
finishav = rowdata['finish'].mean()
|
finishav = rowdata['finish'].mean()
|
||||||
washav = rowdata['wash'].mean()
|
washav = rowdata['wash'].mean()
|
||||||
|
|||||||
@@ -8,34 +8,34 @@
|
|||||||
{% localtime on %}
|
{% localtime on %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{{ js_res | safe }}
|
{{ js_res | safe }}
|
||||||
{{ css_res| safe }}
|
{{ css_res| safe }}
|
||||||
|
|
||||||
<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 type="text/javascript" src="/static/js/bokeh-widgets-0.12.3.min.js"></script>
|
<script type="text/javascript" src="/static/js/bokeh-widgets-0.12.3.min.js"></script>
|
||||||
<script async="true" type="text/javascript">
|
<script async="true" type="text/javascript">
|
||||||
Bokeh.set_log_level("info");
|
Bokeh.set_log_level("info");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{ the_script |safe }}
|
{{ the_script |safe }}
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
||||||
html, body {height: 100%; margin:5px;}
|
html, body {height: 100%; margin:5px;}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="navigation" class="grid_12 alpha">
|
<div id="navigation" class="grid_12 alpha">
|
||||||
{% if user.is_authenticated and mayedit %}
|
{% if user.is_authenticated and mayedit %}
|
||||||
<div class="grid_2 alpha">
|
<div class="grid_2 alpha">
|
||||||
<p>
|
<p>
|
||||||
<a class="button gray small" href="/rowers/workout/{{ id }}/edit">Edit Workout</a>
|
<a class="button gray small" href="/rowers/workout/{{ id }}/edit">Edit Workout</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2 suffix_8 omega">
|
<div class="grid_2 suffix_8 omega">
|
||||||
<p>
|
<p>
|
||||||
<a class="button gray small" href="/rowers/workout/{{ id }}/advanced">Advanced Edit</a>
|
<a class="button gray small" href="/rowers/workout/{{ id }}/advanced">Advanced Edit</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -139,10 +139,11 @@
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% if workstrokesonly %}
|
{% if workstrokesonly %}
|
||||||
<input type="hidden" name="workstrokesonly" value="True">
|
<input type="hidden" name="workstrokesonly" value="True">
|
||||||
|
<input class="grid_2 alpha button blue small" value="Remove Rest Strokes" type="Submit">
|
||||||
{% else %}
|
{% else %}
|
||||||
<input class="grid_2 alpha button blue small" type="hidden" name="workstrokesonly" value="False">
|
<input class="grid_2 alpha button blue small" type="hidden" name="workstrokesonly" value="False">
|
||||||
|
<input class="grid_2 alpha button blue small" value="Include Rest Strokes" type="Submit">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input class="grid_2 alpha button blue small" value="Toggle Work Strokes" type="Submit">
|
|
||||||
</form>
|
</form>
|
||||||
<span class="tooltiptext">If your data source allows, this will show or hide strokes taken during rest intervals.</span>
|
<span class="tooltiptext">If your data source allows, this will show or hide strokes taken during rest intervals.</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -174,10 +174,11 @@
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% if workstrokesonly %}
|
{% if workstrokesonly %}
|
||||||
<input type="hidden" name="workstrokesonly" value="True">
|
<input type="hidden" name="workstrokesonly" value="True">
|
||||||
|
<input class="grid_2 alpha button blue small" value="Remove Rest Strokes" type="Submit">
|
||||||
{% else %}
|
{% else %}
|
||||||
<input class="grid_2 alpha button blue small" type="hidden" name="workstrokesonly" value="False">
|
<input class="grid_2 alpha button blue small" type="hidden" name="workstrokesonly" value="False">
|
||||||
|
<input class="grid_2 alpha button blue small" value="Include Rest Strokes" type="Submit">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input class="grid_2 alpha button blue small" value="Toggle Work Strokes" type="Submit">
|
|
||||||
</form>
|
</form>
|
||||||
<span class="tooltiptext">If your data source allows, this will show or hide strokes taken during rest intervals.</span>
|
<span class="tooltiptext">If your data source allows, this will show or hide strokes taken during rest intervals.</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,22 +8,22 @@
|
|||||||
{% localtime on %}
|
{% localtime on %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{{ js_res | safe }}
|
{{ js_res | safe }}
|
||||||
{{ css_res| safe }}
|
{{ css_res| safe }}
|
||||||
|
|
||||||
<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 type="text/javascript" src="/static/js/bokeh-widgets-0.12.3.min.js"></script>
|
<script type="text/javascript" src="/static/js/bokeh-widgets-0.12.3.min.js"></script>
|
||||||
<script async="true" type="text/javascript">
|
<script async="true" type="text/javascript">
|
||||||
Bokeh.set_log_level("info");
|
Bokeh.set_log_level("info");
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{{ the_script |safe }}
|
{{ the_script |safe }}
|
||||||
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
||||||
html, body {height: 100%; margin:5px;}
|
html, body {height: 100%; margin:5px;}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="navigation" class="grid_12 alpha">
|
<div id="navigation" class="grid_12 alpha">
|
||||||
{% if user.is_authenticated and mayedit %}
|
{% if user.is_authenticated and mayedit %}
|
||||||
@@ -32,13 +32,28 @@
|
|||||||
<a class="button gray small" href="/rowers/workout/{{ id }}/edit">Edit Workout</a>
|
<a class="button gray small" href="/rowers/workout/{{ id }}/edit">Edit Workout</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2 suffix_8 omega">
|
<div class="grid_2 suffix_2">
|
||||||
<p>
|
<p>
|
||||||
<a class="button gray small" href="/rowers/workout/{{ id }}/advanced">Advanced Edit</a>
|
<a class="button gray small" href="/rowers/workout/{{ id }}/advanced">Advanced Edit</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="grid_2 suffix_4 omega tooltip">
|
||||||
|
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% if workstrokesonly %}
|
||||||
|
<input type="hidden" name="workstrokesonly" value="True">
|
||||||
|
<input class="grid_2 alpha button blue small" value="Remove Rest Strokes" type="Submit">
|
||||||
|
{% else %}
|
||||||
|
<input class="grid_2 alpha button blue small" type="hidden" name="workstrokesonly" value="False">
|
||||||
|
<input class="grid_2 alpha button blue small" value="Include Rest Strokes" type="Submit">
|
||||||
|
{% endif %}
|
||||||
|
</form>
|
||||||
|
<span class="tooltiptext">If your data source allows, this will show or hide strokes taken during rest intervals.</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1463,7 +1463,7 @@ def cum_flex(request,theuser=0,
|
|||||||
})
|
})
|
||||||
|
|
||||||
@user_passes_test(promember,login_url="/",redirect_field_name=None)
|
@user_passes_test(promember,login_url="/",redirect_field_name=None)
|
||||||
def workout_forcecurve_view(request,id=0):
|
def workout_forcecurve_view(request,id=0,workstrokesonly=False):
|
||||||
row = Workout.objects.get(id=id)
|
row = Workout.objects.get(id=id)
|
||||||
promember=0
|
promember=0
|
||||||
mayedit=0
|
mayedit=0
|
||||||
@@ -1478,7 +1478,15 @@ def workout_forcecurve_view(request,id=0):
|
|||||||
if not promember:
|
if not promember:
|
||||||
return HttpResponseRedirect("/rowers/about/")
|
return HttpResponseRedirect("/rowers/about/")
|
||||||
|
|
||||||
script,div,js_resources,css_resources = interactive_forcecurve([row])
|
if request.method == 'POST' and 'workstrokesonly' in request.POST:
|
||||||
|
workstrokesonly = request.POST['workstrokesonly']
|
||||||
|
if workstrokesonly == 'True':
|
||||||
|
workstrokesonly = True
|
||||||
|
else:
|
||||||
|
workstrokesonly = False
|
||||||
|
|
||||||
|
script,div,js_resources,css_resources = interactive_forcecurve([row],
|
||||||
|
workstrokesonly=workstrokesonly)
|
||||||
|
|
||||||
return render(request,
|
return render(request,
|
||||||
'forcecurve_single.html',
|
'forcecurve_single.html',
|
||||||
@@ -1489,6 +1497,7 @@ def workout_forcecurve_view(request,id=0):
|
|||||||
'css_res':css_resources,
|
'css_res':css_resources,
|
||||||
'id':id,
|
'id':id,
|
||||||
'mayedit':mayedit,
|
'mayedit':mayedit,
|
||||||
|
'workstrokesonly': not workstrokesonly,
|
||||||
})
|
})
|
||||||
|
|
||||||
@login_required()
|
@login_required()
|
||||||
|
|||||||
Reference in New Issue
Block a user