cumulative flex now also for OTW
This commit is contained in:
@@ -853,7 +853,7 @@ def getrowdata_db(id=0,doclean=False):
|
|||||||
def getsmallrowdata_db(columns,ids=[],doclean=True,workstrokesonly=True):
|
def getsmallrowdata_db(columns,ids=[],doclean=True,workstrokesonly=True):
|
||||||
prepmultipledata(ids)
|
prepmultipledata(ids)
|
||||||
data = read_cols_df_sql(ids,columns)
|
data = read_cols_df_sql(ids,columns)
|
||||||
|
|
||||||
if 'peakforce' in columns:
|
if 'peakforce' in columns:
|
||||||
data['peakforce'] = data['peakforce']*lbstoN
|
data['peakforce'] = data['peakforce']*lbstoN
|
||||||
if 'averageforce' in columns:
|
if 'averageforce' in columns:
|
||||||
@@ -862,7 +862,7 @@ def getsmallrowdata_db(columns,ids=[],doclean=True,workstrokesonly=True):
|
|||||||
if doclean:
|
if doclean:
|
||||||
data = clean_df_stats(data,ignorehr=True,
|
data = clean_df_stats(data,ignorehr=True,
|
||||||
workstrokesonly=workstrokesonly)
|
workstrokesonly=workstrokesonly)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
# Fetch both the workout and the workout stroke data (from CSV file)
|
# Fetch both the workout and the workout stroke data (from CSV file)
|
||||||
@@ -921,7 +921,7 @@ def prepmultipledata(ids,verbose=False):
|
|||||||
def read_cols_df_sql(ids,columns):
|
def read_cols_df_sql(ids,columns):
|
||||||
# drop columns that are not in offical list
|
# drop columns that are not in offical list
|
||||||
# axx = [ax[0] for ax in axes]
|
# axx = [ax[0] for ax in axes]
|
||||||
axx = StrokeData._meta.get_all_field_names()
|
axx = [f.name for f in StrokeData._meta.get_fields()]
|
||||||
for c in columns:
|
for c in columns:
|
||||||
if not c in axx:
|
if not c in axx:
|
||||||
columns.remove(c)
|
columns.remove(c)
|
||||||
|
|||||||
@@ -889,12 +889,14 @@ def interactive_chart(id=0,promember=0):
|
|||||||
def interactive_cum_flex_chart2(theworkouts,promember=0,
|
def interactive_cum_flex_chart2(theworkouts,promember=0,
|
||||||
xparam='spm',
|
xparam='spm',
|
||||||
yparam1='power',
|
yparam1='power',
|
||||||
yparam2='spm'):
|
yparam2='spm',
|
||||||
|
workstrokesonly=False):
|
||||||
|
|
||||||
# datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2)
|
# datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2)
|
||||||
ids = [int(w.id) for w in theworkouts]
|
ids = [int(w.id) for w in theworkouts]
|
||||||
columns = [xparam,yparam1,yparam2,'spm','driveenergy','distance']
|
columns = [xparam,yparam1,yparam2,'spm','driveenergy','distance']
|
||||||
datadf = dataprep.getsmallrowdata_db(columns,ids=ids,doclean=False)
|
datadf = dataprep.getsmallrowdata_db(columns,ids=ids,doclean=False,
|
||||||
|
workstrokesonly=workstrokesonly)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tests = datadf[yparam2]
|
tests = datadf[yparam2]
|
||||||
@@ -1176,7 +1178,6 @@ def interactive_flex_chart2(id=0,promember=0,
|
|||||||
workstrokesonly=False):
|
workstrokesonly=False):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#rowdata,row = dataprep.getrowdata_db(id=id)
|
#rowdata,row = dataprep.getrowdata_db(id=id)
|
||||||
columns = [xparam,yparam1,yparam2,
|
columns = [xparam,yparam1,yparam2,
|
||||||
'ftime','distance','fpace',
|
'ftime','distance','fpace',
|
||||||
|
|||||||
@@ -6,150 +6,153 @@
|
|||||||
|
|
||||||
{% 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>
|
||||||
|
|
||||||
{{ interactiveplot |safe }}
|
{{ interactiveplot |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="title" class="grid_12 alpha">
|
<div id="title" class="grid_12 alpha">
|
||||||
<h1>Indoor Rower Stroke Analysis</h1>
|
<h1>Indoor Rower Stroke Analysis</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="summary" class="grid_6 alpha">
|
<div class="grid_12 alpha">
|
||||||
|
<div id="form" class="grid_6 alpha">
|
||||||
|
<p>Warning: Large date ranges may take a long time to load. Huge date ranges may crash your browser.</p>
|
||||||
|
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||||
<p>Summary for {{ theuser.first_name }} {{ theuser.last_name }}
|
{% csrf_token %}
|
||||||
between {{ startdate|date }} and {{ enddate|date }}</p>
|
<div class="grid_2 alpha">
|
||||||
|
<table>
|
||||||
|
{{ optionsform.as_table }}
|
||||||
<div id="plotbuttons" class="grid_6 alpha">
|
</table>
|
||||||
<div class="grid_2 alpha dropdown">
|
</div>
|
||||||
<button class="grid_2 alpha button blue small dropbtn">X-axis</button>
|
<div class="grid_2 suffix_2 omega">
|
||||||
<div class="dropdown-content">
|
<input type="hidden" name="options" value="options">
|
||||||
{% if promember %}
|
<input class="grid_1 alpha button green small" value="Submit" type="Submit">
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/power/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Power</a>
|
</div>
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/hr/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">HR</a>
|
</form>
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/spm/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">SPM</a>
|
</div>
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/peakforce/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Peak Force</a>
|
<div class="grid_6 omega">
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/averageforce/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Average Force</a>
|
<p>Use this form to select a different date range:</p>
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/forceratio/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Average/Peak Force Ratio</a>
|
<p>
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/drivelength/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Drive Length</a>
|
Select start and end date for a date range:
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/driveenergy/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Work per Stroke</a>
|
<div class="grid_4 alpha">
|
||||||
<a class="button blue small alpha" href="/rowers/flexall/drivespeed/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Drive Speed</a>
|
|
||||||
{% else %}
|
<form enctype="multipart/form-data" action="" method="post">
|
||||||
<a class="button rosy small" href="/rowers/promembership">Power (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">HR (Pro)</a>
|
<table>
|
||||||
<a class="button rosy small" href="/rowers/promembership">SPM (Pro)</a>
|
{{ form.as_table }}
|
||||||
<a class="button rosy small" href="/rowers/promembership">Peak Force (Pro)</a>
|
</table>
|
||||||
<a class="button rosy small" href="/rowers/promembership">Average Force (Pro)</a>
|
{% csrf_token %}
|
||||||
<a class="button rosy small" href="/rowers/promembership">Average/Peak Force Ratio (Pro)</a>
|
</div>
|
||||||
<a class="button rosy small" href="/rowers/promembership">Drive Length (Pro)</a>
|
<div class="grid_2 omega">
|
||||||
<a class="button rosy small" href="/rowers/promembership">Work per Stroke (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Drive Speed (Pro)</a>
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid_2 dropdown">
|
|
||||||
<button class="grid_2 alpha button blue small dropbtn">Left</button>
|
|
||||||
<div class="dropdown-content">
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/hr/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">HR</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/spm/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">SPM</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/power/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Power</a>
|
|
||||||
{% if promember %}
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/peakforce/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Peak Force</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/averageforce/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Average Force</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/forceratio/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Average/Peak Force Ratio</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/drivelength/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Drive Length</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/driveenergy/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Work per Stroke</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/drivespeed/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Drive Speed</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Peak Force (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Average Force (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Avxerage/Peak Force Ratio (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Drive Length (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Work per Stroke (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Drive Speed (Pro)</a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid_2 dropdown omega">
|
|
||||||
<button class="grid_2 alpha button blue small dropbtn">Right</button>
|
|
||||||
<div class="dropdown-content">
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/hr/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">HR</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/spm/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">SPM</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/power/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Power</a>
|
|
||||||
{% if promember %}
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/peakforce/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Peak Force</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/averageforce/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Average Force</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/forceratio/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Average/Peak Force Ratio</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/drivelength/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Drive Length</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/driveenergy/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Work per Stroke</a>
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/drivespeed/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">Drive Speed</a>
|
|
||||||
{% else %}
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Peak Force (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Average Force (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Average/Peak Force Ratio (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Drive Length (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Work per Stroke (Pro)</a>
|
|
||||||
<a class="button rosy small" href="/rowers/promembership">Drive Speed (Pro)</a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/None/{{startdate|date:"Y-m-d"}}/{{ enddate|date:"Y-m-d"}}">None</a>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div class="grid_6 alpha">
|
|
||||||
<p> </p>
|
|
||||||
<p>Warning: Large date ranges may take a long time to load. Huge date ranges may crash your browser.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="form" class="grid_6 omega">
|
|
||||||
<p>Use this form to select a different date range:</p>
|
|
||||||
<p>
|
|
||||||
Select start and end date for a date range:
|
|
||||||
<div class="grid_4 alpha">
|
|
||||||
|
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
|
||||||
|
|
||||||
<table>
|
|
||||||
{{ form.as_table }}
|
|
||||||
</table>
|
|
||||||
{% csrf_token %}
|
|
||||||
</div>
|
|
||||||
<div class="grid_2 omega">
|
|
||||||
<input name='daterange' class="button green" type="submit" value="Submit"> </form>
|
<input name='daterange' class="button green" type="submit" value="Submit"> </form>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_4 alpha">
|
<div class="grid_4 alpha">
|
||||||
<form enctype="multipart/form-data" action="" method="post">
|
<form enctype="multipart/form-data" action="" method="post">
|
||||||
Or use the last {{ deltaform }} days.
|
Or use the last {{ deltaform }} days.
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2 omega">
|
<div class="grid_2 omega">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input name='datedelta' class="button green" type="submit" value="Submit">
|
<input name='datedelta' class="button green" type="submit" value="Submit">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="summary" class="grid_6 suffix_6 alpha">
|
||||||
|
|
||||||
|
<p>Summary for {{ theuser.first_name }} {{ theuser.last_name }}
|
||||||
|
between {{ startdate|date }} and {{ enddate|date }}</p>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="plotbuttons" class="grid_6 alpha">
|
||||||
|
<div class="grid_2 alpha dropdown">
|
||||||
|
<button class="grid_2 alpha button blue small dropbtn">X-axis</button>
|
||||||
|
<div class="dropdown-content">
|
||||||
|
{% for key, value in axchoicesbasic.items %}
|
||||||
|
{% if key != 'None' %}
|
||||||
|
<a class="button blue small alpha" href="/rowers/flexall/{{ key }}/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">{{ value }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if promember %}
|
||||||
|
{% for key, value in axchoicespro.items %}
|
||||||
|
<a class="button blue small alpha" href="/rowers/flexall/{{ key }}/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">{{ value }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% for key, value in axchoicespro.items %}
|
||||||
|
<a class="button rosy small" href="/rowers/promembership">{{ value }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid_2 dropdown">
|
||||||
|
<button class="grid_2 alpha button blue small dropbtn">Left</button>
|
||||||
|
<div class="dropdown-content">
|
||||||
|
{% for key, value in axchoicesbasic.items %}
|
||||||
|
{% if key not in noylist and key != 'None' %}
|
||||||
|
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ key }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d"}}/{{ enddate|date:"Y-m-d"}}">{{ value }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if promember %}
|
||||||
|
{% for key, value in axchoicespro.items %}
|
||||||
|
{% if key not in noylist %}
|
||||||
|
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ key }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d"}}/{{ enddate|date:"Y-m-d"}}">{{ value }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% for key, value in axchoicespro.items %}
|
||||||
|
{% if key not in noylist %}
|
||||||
|
<a class="button rosy small" href="/rowers/promembership">{{ value }} (Pro)</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid_2 dropdown omega">
|
||||||
|
<button class="grid_2 alpha button blue small dropbtn">Right</button>
|
||||||
|
<div class="dropdown-content">
|
||||||
|
{% for key, value in axchoicesbasic.items %}
|
||||||
|
{% if key not in noylist %}
|
||||||
|
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/{{ key }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">{{ value }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if promember %}
|
||||||
|
{% for key, value in axchoicespro.items %}
|
||||||
|
{% if key not in noylist %}
|
||||||
|
<a class="button blue small" href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/{{ key }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}">{{ value }}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% for key, value in axchoicespro.items %}
|
||||||
|
{% if key not in noylist %}
|
||||||
|
<a class="button rosy small" href="/rowers/promembership">{{ value }} (Pro)</a>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +162,7 @@
|
|||||||
<div id="graph" class="grid_12 alpha">
|
<div id="graph" class="grid_12 alpha">
|
||||||
|
|
||||||
{{ the_div|safe }}
|
{{ the_div|safe }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -2096,8 +2096,21 @@ def cum_flex(request,theuser=0,
|
|||||||
enddate=timezone.now()+datetime.timedelta(days=1),
|
enddate=timezone.now()+datetime.timedelta(days=1),
|
||||||
deltadays=-1,
|
deltadays=-1,
|
||||||
startdatestring="",
|
startdatestring="",
|
||||||
enddatestring=""):
|
enddatestring="",
|
||||||
|
options={
|
||||||
|
'includereststrokes':False,
|
||||||
|
'workouttypes':['rower','dynamic','slides']
|
||||||
|
}):
|
||||||
|
|
||||||
|
if 'options' in request.session:
|
||||||
|
options = request.session['options']
|
||||||
|
|
||||||
|
workouttypes = options['workouttypes']
|
||||||
|
includereststrokes = options['includereststrokes']
|
||||||
|
workstrokesonly = not includereststrokes
|
||||||
|
checktypes = ['water','rower','dynamic','slides','skierg',
|
||||||
|
'paddle','snow','other']
|
||||||
|
|
||||||
if deltadays>0:
|
if deltadays>0:
|
||||||
startdate = enddate-datetime.timedelta(days=int(deltadays))
|
startdate = enddate-datetime.timedelta(days=int(deltadays))
|
||||||
|
|
||||||
@@ -2131,6 +2144,7 @@ def cum_flex(request,theuser=0,
|
|||||||
if request.method == 'POST' and "daterange" in request.POST:
|
if request.method == 'POST' and "daterange" in request.POST:
|
||||||
form = DateRangeForm(request.POST)
|
form = DateRangeForm(request.POST)
|
||||||
deltaform = DeltaDaysForm(request.POST)
|
deltaform = DeltaDaysForm(request.POST)
|
||||||
|
optionsform = StatsOptionsForm()
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
startdate = form.cleaned_data['startdate']
|
startdate = form.cleaned_data['startdate']
|
||||||
enddate = form.cleaned_data['enddate']
|
enddate = form.cleaned_data['enddate']
|
||||||
@@ -2140,9 +2154,10 @@ def cum_flex(request,theuser=0,
|
|||||||
startdate = s
|
startdate = s
|
||||||
elif request.method == 'POST' and "datedelta" in request.POST:
|
elif request.method == 'POST' and "datedelta" in request.POST:
|
||||||
deltaform = DeltaDaysForm(request.POST)
|
deltaform = DeltaDaysForm(request.POST)
|
||||||
|
optionsform = StatsOptionsForm()
|
||||||
if deltaform.is_valid():
|
if deltaform.is_valid():
|
||||||
deltadays = deltaform.cleaned_data['deltadays']
|
deltadays = deltaform.cleaned_data['deltadays']
|
||||||
if deltadays != 0:
|
if deltadays != 0 and isinstance(deltadays, Number):
|
||||||
enddate = timezone.now()
|
enddate = timezone.now()
|
||||||
startdate = enddate-datetime.timedelta(days=deltadays)
|
startdate = enddate-datetime.timedelta(days=deltadays)
|
||||||
if startdate > enddate:
|
if startdate > enddate:
|
||||||
@@ -2153,23 +2168,50 @@ def cum_flex(request,theuser=0,
|
|||||||
'startdate': startdate,
|
'startdate': startdate,
|
||||||
'enddate': enddate,
|
'enddate': enddate,
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
form = DateRangeForm()
|
||||||
|
optionsform = StatsOptionsForm()
|
||||||
|
elif request.method == 'POST' and 'options' in request.POST:
|
||||||
|
optionsform = StatsOptionsForm(request.POST)
|
||||||
|
if optionsform.is_valid():
|
||||||
|
includereststrokes = optionsform.cleaned_data['includereststrokes']
|
||||||
|
workstrokesonly = not includereststrokes
|
||||||
|
workouttypes = []
|
||||||
|
for type in checktypes:
|
||||||
|
if optionsform.cleaned_data[type]:
|
||||||
|
workouttypes.append(type)
|
||||||
|
|
||||||
|
options = {
|
||||||
|
'includereststrokes':includereststrokes,
|
||||||
|
'workouttypes':workouttypes,
|
||||||
|
}
|
||||||
|
form = DateRangeForm(initial={
|
||||||
|
'startdate': startdate,
|
||||||
|
'enddate': enddate,
|
||||||
|
})
|
||||||
|
deltaform = DeltaDaysForm()
|
||||||
|
else:
|
||||||
|
form = DateRangeForm(initial={
|
||||||
|
'startdate': startdate,
|
||||||
|
'enddate': enddate,
|
||||||
|
})
|
||||||
|
deltaform = DeltaDaysForm()
|
||||||
else:
|
else:
|
||||||
form = DateRangeForm(initial={
|
form = DateRangeForm(initial={
|
||||||
'startdate': startdate,
|
'startdate': startdate,
|
||||||
'enddate': enddate,
|
'enddate': enddate,
|
||||||
})
|
})
|
||||||
deltaform = DeltaDaysForm()
|
deltaform = DeltaDaysForm()
|
||||||
|
optionsform = StatsOptionsForm()
|
||||||
try:
|
try:
|
||||||
r2 = Rower.objects.get(user=theuser)
|
r2 = Rower.objects.get(user=theuser)
|
||||||
allergworkouts = Workout.objects.filter(user=r2,
|
allworkouts = Workout.objects.filter(user=r2,
|
||||||
workouttype__in=['rower','dynamic','slides'],
|
workouttype__in=workouttypes,
|
||||||
startdatetime__gte=startdate,
|
startdatetime__gte=startdate,
|
||||||
startdatetime__lte=enddate)
|
startdatetime__lte=enddate)
|
||||||
|
|
||||||
except Rower.DoesNotExist:
|
except Rower.DoesNotExist:
|
||||||
allergworkouts = []
|
allworkouts = []
|
||||||
r2=0
|
r2=0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -2177,11 +2219,12 @@ def cum_flex(request,theuser=0,
|
|||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
u = ''
|
u = ''
|
||||||
|
|
||||||
if allergworkouts:
|
if allworkouts:
|
||||||
res = interactive_cum_flex_chart2(allergworkouts,xparam=xparam,
|
res = interactive_cum_flex_chart2(allworkouts,xparam=xparam,
|
||||||
yparam1=yparam1,
|
yparam1=yparam1,
|
||||||
yparam2=yparam2,
|
yparam2=yparam2,
|
||||||
promember=promember)
|
promember=promember,
|
||||||
|
workstrokesonly=workstrokesonly)
|
||||||
script = res[0]
|
script = res[0]
|
||||||
div = res[1]
|
div = res[1]
|
||||||
js_resources = res[2]
|
js_resources = res[2]
|
||||||
@@ -2192,6 +2235,26 @@ def cum_flex(request,theuser=0,
|
|||||||
js_resources = ''
|
js_resources = ''
|
||||||
css_resources = ''
|
css_resources = ''
|
||||||
|
|
||||||
|
axchoicesbasic = {ax[0]:ax[1] for ax in axes if ax[4]=='basic'}
|
||||||
|
axchoicespro = {ax[0]:ax[1] for ax in axes if ax[4]=='pro'}
|
||||||
|
noylist = ["time","distance"]
|
||||||
|
axchoicesbasic.pop("cumdist")
|
||||||
|
|
||||||
|
# set options form correctly
|
||||||
|
initial = {}
|
||||||
|
initial['includereststrokes'] = includereststrokes
|
||||||
|
|
||||||
|
for wtype in checktypes:
|
||||||
|
if wtype in workouttypes:
|
||||||
|
initial[wtype] = True
|
||||||
|
else:
|
||||||
|
initial[wtype] = False
|
||||||
|
|
||||||
|
|
||||||
|
optionsform = StatsOptionsForm(initial=initial)
|
||||||
|
|
||||||
|
request.session['options'] = options
|
||||||
|
|
||||||
return render(request, 'cum_flex.html',
|
return render(request, 'cum_flex.html',
|
||||||
{'interactiveplot':script,
|
{'interactiveplot':script,
|
||||||
'the_div':div,
|
'the_div':div,
|
||||||
@@ -2202,12 +2265,16 @@ def cum_flex(request,theuser=0,
|
|||||||
'startdate':startdate,
|
'startdate':startdate,
|
||||||
'enddate':enddate,
|
'enddate':enddate,
|
||||||
'form':form,
|
'form':form,
|
||||||
|
'optionsform':optionsform,
|
||||||
'deltaform':deltaform,
|
'deltaform':deltaform,
|
||||||
'xparam':xparam,
|
'xparam':xparam,
|
||||||
'yparam1':yparam1,
|
'yparam1':yparam1,
|
||||||
'yparam2':yparam2,
|
'yparam2':yparam2,
|
||||||
'promember':promember,
|
'promember':promember,
|
||||||
'teams':get_my_teams(request.user),
|
'teams':get_my_teams(request.user),
|
||||||
|
'axchoicesbasic':axchoicesbasic,
|
||||||
|
'axchoicespro':axchoicespro,
|
||||||
|
'noylist':noylist,
|
||||||
})
|
})
|
||||||
|
|
||||||
# Show the EMpower Oarlock generated Stroke Profile
|
# Show the EMpower Oarlock generated Stroke Profile
|
||||||
|
|||||||
Reference in New Issue
Block a user