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 timedeltaconv
|
||||
|
||||
def interactive_forcecurve(theworkouts):
|
||||
def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
||||
|
||||
ids = [int(w.id) for w in theworkouts]
|
||||
@@ -133,10 +133,21 @@ def interactive_forcecurve(theworkouts):
|
||||
boattype = theworkouts[0].boattype
|
||||
|
||||
columns = ['catch','slip','wash','finish','averageforce',
|
||||
'peakforceangle','peakforce','spm','distance']
|
||||
'peakforceangle','peakforce','spm','distance',
|
||||
'workoutstate']
|
||||
|
||||
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()
|
||||
finishav = rowdata['finish'].mean()
|
||||
washav = rowdata['wash'].mean()
|
||||
|
||||
@@ -8,34 +8,34 @@
|
||||
{% localtime on %}
|
||||
{% block content %}
|
||||
|
||||
{{ js_res | safe }}
|
||||
{{ css_res| safe }}
|
||||
{{ js_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-widgets-0.12.3.min.js"></script>
|
||||
<script async="true" type="text/javascript">
|
||||
<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 async="true" type="text/javascript">
|
||||
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.*/
|
||||
html, body {height: 100%; margin:5px;}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
<div id="navigation" class="grid_12 alpha">
|
||||
{% 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>
|
||||
</p>
|
||||
</div>
|
||||
<div class="grid_2 suffix_8 omega">
|
||||
<p>
|
||||
<a class="button gray small" href="/rowers/workout/{{ id }}/advanced">Advanced Edit</a>
|
||||
</p>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -139,10 +139,11 @@
|
||||
{% 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 %}
|
||||
<input class="grid_2 alpha button blue small" value="Toggle Work Strokes" type="Submit">
|
||||
</form>
|
||||
<span class="tooltiptext">If your data source allows, this will show or hide strokes taken during rest intervals.</span>
|
||||
</div>
|
||||
|
||||
@@ -174,10 +174,11 @@
|
||||
{% 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 %}
|
||||
<input class="grid_2 alpha button blue small" value="Toggle Work Strokes" type="Submit">
|
||||
</form>
|
||||
<span class="tooltiptext">If your data source allows, this will show or hide strokes taken during rest intervals.</span>
|
||||
</div>
|
||||
|
||||
@@ -8,22 +8,22 @@
|
||||
{% localtime on %}
|
||||
{% block content %}
|
||||
|
||||
{{ js_res | safe }}
|
||||
{{ css_res| safe }}
|
||||
{{ js_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-widgets-0.12.3.min.js"></script>
|
||||
<script async="true" type="text/javascript">
|
||||
<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 async="true" type="text/javascript">
|
||||
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.*/
|
||||
html, body {height: 100%; margin:5px;}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
<div id="navigation" class="grid_12 alpha">
|
||||
{% if user.is_authenticated and mayedit %}
|
||||
@@ -32,13 +32,28 @@
|
||||
<a class="button gray small" href="/rowers/workout/{{ id }}/edit">Edit Workout</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="grid_2 suffix_8 omega">
|
||||
<div class="grid_2 suffix_2">
|
||||
<p>
|
||||
<a class="button gray small" href="/rowers/workout/{{ id }}/advanced">Advanced Edit</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
{% 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>
|
||||
|
||||
|
||||
|
||||
@@ -1463,7 +1463,7 @@ def cum_flex(request,theuser=0,
|
||||
})
|
||||
|
||||
@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)
|
||||
promember=0
|
||||
mayedit=0
|
||||
@@ -1478,7 +1478,15 @@ def workout_forcecurve_view(request,id=0):
|
||||
if not promember:
|
||||
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,
|
||||
'forcecurve_single.html',
|
||||
@@ -1489,6 +1497,7 @@ def workout_forcecurve_view(request,id=0):
|
||||
'css_res':css_resources,
|
||||
'id':id,
|
||||
'mayedit':mayedit,
|
||||
'workstrokesonly': not workstrokesonly,
|
||||
})
|
||||
|
||||
@login_required()
|
||||
|
||||
Reference in New Issue
Block a user