flexall done
some details not 100%
This commit is contained in:
@@ -1,35 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
{% extends "newbase.html" %}
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
{% block title %}Rowsandall {% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div id="id_css_res">
|
||||
<link rel="stylesheet" href="/static/css/bokeh-0.12.3.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="/static/css/bokeh-widgets-0.12.3.min.css" type="text/css" />
|
||||
</div>
|
||||
<div id="id_js_res">
|
||||
<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>
|
||||
|
||||
</div>
|
||||
|
||||
{% block main %}
|
||||
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Get the form fields and hidden div
|
||||
var checkbox = $("#id_water");
|
||||
var modality = $("#id_modality");
|
||||
var hidden = $("#id_waterboattype");
|
||||
|
||||
|
||||
@@ -43,11 +24,12 @@
|
||||
|
||||
// Setup an event listener for when the state of the
|
||||
// checkbox changes.
|
||||
checkbox.change(function() {
|
||||
modality.change(function() {
|
||||
// Check to see if the checkbox is checked.
|
||||
// If it is, show the fields and populate the input.
|
||||
// If not, hide the fields.
|
||||
if (checkbox.is(':checked')) {
|
||||
// If not, hide the fields.
|
||||
var Value = modality.val();
|
||||
if (Value=='water') {
|
||||
// Show the hidden fields.
|
||||
hidden.show();
|
||||
} else {
|
||||
@@ -74,173 +56,170 @@
|
||||
</script>
|
||||
|
||||
|
||||
<div id="id_css_res">
|
||||
<link rel="stylesheet" href="/static/css/bokeh-0.12.3.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="/static/css/bokeh-widgets-0.12.3.min.css" type="text/css" />
|
||||
</div>
|
||||
<div id="id_js_res">
|
||||
<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>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||
|
||||
|
||||
<div id="id_script">
|
||||
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
||||
html, body {height: 100%; margin:5px;}
|
||||
</style>
|
||||
|
||||
|
||||
<div id="title" class="grid_12 alpha">
|
||||
<div class="grid_10 alpha">
|
||||
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
{% if user.is_authenticated and user|is_manager %}
|
||||
<div class="grid_2 alpha dropdown">
|
||||
<button class="grid_2 alpha button green small dropbtn">
|
||||
{{ theuser.first_name }} {{ theuser.last_name }}
|
||||
</button>
|
||||
<div class="dropdown-content">
|
||||
{% for member in user|team_members %}
|
||||
<a class="button green small" href="/rowers/{{ member.id }}/flexall/{{ xparam }}/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}">{{ member.first_name }} {{ member.last_name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid_12 alpha">
|
||||
<div id="form" class="grid_6 alpha">
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="grid_2 alpha">
|
||||
<table>
|
||||
{{ optionsform.as_table }}
|
||||
</table>
|
||||
</div>
|
||||
<div class="grid_2 suffix_2 omega">
|
||||
<input type="hidden" name="options" value="options">
|
||||
<input class="grid_1 alpha button green small" value="Submit" type="Submit">
|
||||
</div>
|
||||
|
||||
<table>
|
||||
{{ optionsform.as_table }}
|
||||
</table>
|
||||
<input type="hidden" name="options" value="options">
|
||||
<input class="button green small" value="Submit" type="Submit">
|
||||
</form>
|
||||
</div>
|
||||
<div class="grid_6 omega">
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<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">
|
||||
<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>
|
||||
</div>
|
||||
<div class="grid_4 alpha">
|
||||
<form enctype="multipart/form-data" action="" method="post">
|
||||
Or use the last {{ deltaform }} days.
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<input name='datedelta' class="button green" type="submit" value="Submit">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<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>
|
||||
<li>
|
||||
<p>Summary for {{ theuser.first_name }} {{ theuser.last_name }}
|
||||
between {{ startdate|date }} and {{ enddate|date }}</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<ul class="cd-accordion-menu animated">
|
||||
<li class="has-children" id="xaxis">
|
||||
<input type="checkbox" name="group-x" id="group-x">
|
||||
<label for="group-x">
|
||||
X-Axis
|
||||
</label>
|
||||
<ul>
|
||||
{% for key, value in axchoicesbasic.items %}
|
||||
{% if key != 'None' %}
|
||||
<li>
|
||||
<a href="/rowers/flexall/{{ key }}/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if promember %}
|
||||
{% for key, value in axchoicespro.items %}
|
||||
<li>
|
||||
<a href="/rowers/flexall/{{ key }}/{{ yparam1 }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for key, value in axchoicespro.items %}
|
||||
<li>
|
||||
<a href="/rowers/promembership">{{ value }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="cd-accordion-menu animated">
|
||||
<li class="has-children" id="yparam1">
|
||||
<input type="checkbox" name="group-y1" id="group-y1">
|
||||
<label for="group-y1">
|
||||
Left
|
||||
</label>
|
||||
<ul>
|
||||
{% for key, value in axchoicesbasic.items %}
|
||||
{% if key not in noylist and key != 'None' %}
|
||||
<li>
|
||||
<a href="/rowers/flexall/{{ xparam }}/{{ key }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if promember %}
|
||||
{% for key, value in axchoicespro.items %}
|
||||
{% if key not in noylist %}
|
||||
<li>
|
||||
<a href="/rowers/flexall/{{ xparam }}/{{ key }}/{{ yparam2 }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for key, value in axchoicespro.items %}
|
||||
{% if key not in noylist %}
|
||||
<li>
|
||||
<a href="/rowers/promembership">{{ value }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<ul class="cd-accordion-menu animated">
|
||||
<li class="has-children" id="yparam2">
|
||||
<input type="checkbox" name="group-y2" id="group-y2">
|
||||
<label for="group-y2">
|
||||
Right
|
||||
</label>
|
||||
<ul>
|
||||
{% for key, value in axchoicesbasic.items %}
|
||||
{% if key not in noylist and key != 'None' %}
|
||||
<li>
|
||||
<a href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/{{ key }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if promember %}
|
||||
{% for key, value in axchoicespro.items %}
|
||||
{% if key not in noylist %}
|
||||
<li>
|
||||
<a href="/rowers/flexall/{{ xparam }}/{{ yparam1 }}/{{ key }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d"}}/">{{ value }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% for key, value in axchoicespro.items %}
|
||||
{% if key not in noylist %}
|
||||
<li>
|
||||
<a href="/rowers/promembership">{{ value }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
<div id="id_chart">
|
||||
|
||||
<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>
|
||||
{{ the_div|safe }}
|
||||
</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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="id_chart" class="grid_12 alpha">
|
||||
|
||||
{{ the_div|safe }}
|
||||
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -253,16 +232,25 @@
|
||||
$(function($) {
|
||||
console.log('loading script');
|
||||
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/flexalldata', function(json) {
|
||||
console.log('got script');
|
||||
var counter=0;
|
||||
var script = json.script;
|
||||
var div = json.div;
|
||||
console.log('set vars');
|
||||
$("#id_sitready").remove();
|
||||
console.log('sitready removed');
|
||||
$("#id_chart").append(div);
|
||||
console.log(div);
|
||||
console.log('div appended');
|
||||
$("#id_script").append("<script>"+script+"</s"+"cript>");
|
||||
console.log('script changed');
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_analytics.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -291,3 +291,6 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}
|
||||
{% include 'menu_racing.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -208,11 +208,11 @@ urlpatterns = [
|
||||
url(r'^ote-ranking/(?P<deltadays>\d+)$',views.oterankings_view),
|
||||
url(r'^ote-ranking/$',views.oterankings_view),
|
||||
url(r'^ote-ranking/user/(?P<theuser>\d+)/$',views.oterankings_view),
|
||||
url(r'^(?P<theuser>\d+)/flexall/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.cum_flex),
|
||||
url(r'^flexall/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.cum_flex),
|
||||
url(r'^flexall/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)$',views.cum_flex),
|
||||
url(r'^flexall/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)/user/(?P<theuser>\d+)$',views.cum_flex),
|
||||
url(r'^flexall/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)/$',views.cum_flex),
|
||||
url(r'^flexall/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/$',views.cum_flex),
|
||||
url(r'^flexall/user/(?P<theuser>\d+)/$',views.cum_flex),
|
||||
url(r'^flexall/$',views.cum_flex),
|
||||
|
||||
url(r'^flexalldata/$',views.cum_flex_data),
|
||||
|
||||
url(r'^histo/u/(?P<theuser>\d+)$',views.histo),
|
||||
|
||||
223
rowers/views.py
223
rowers/views.py
@@ -2455,7 +2455,7 @@ def cum_flex_data(
|
||||
options={
|
||||
'includereststrokes':False,
|
||||
'rankingonly':False,
|
||||
'workouttypes':[i[0] for i in types.workouttypes],
|
||||
'modality':'all',
|
||||
'waterboattype':types.waterboattype,
|
||||
'theuser':0,
|
||||
'xparam':'spm',
|
||||
@@ -2472,7 +2472,7 @@ def cum_flex_data(
|
||||
options = request.session['options']
|
||||
|
||||
try:
|
||||
workouttypes = options['workouttypes']
|
||||
modality = options['modality']
|
||||
rankingonly = options['rankingonly']
|
||||
includereststrokes = options['includereststrokes']
|
||||
waterboattype = options['waterboattype']
|
||||
@@ -2485,7 +2485,7 @@ def cum_flex_data(
|
||||
enddatestring = options['enddatestring']
|
||||
deltadays = options['deltadays']
|
||||
except KeyError:
|
||||
workouttypes = def_options['workouttypes']
|
||||
modality = def_options['modality']
|
||||
rankingonly = def_options['rankingonly']
|
||||
includereststrokes = def_options['includereststrokes']
|
||||
waterboattype = def_options['waterboattype']
|
||||
@@ -2500,6 +2500,10 @@ def cum_flex_data(
|
||||
request.session['options'] = def_options
|
||||
|
||||
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
else:
|
||||
modalities = [modality]
|
||||
|
||||
try:
|
||||
startdate = iso8601.parse_date(startdatestring)
|
||||
@@ -2538,7 +2542,7 @@ def cum_flex_data(
|
||||
rankingpiece = [True,False]
|
||||
|
||||
allworkouts = Workout.objects.filter(user=r2,
|
||||
workouttype__in=workouttypes,
|
||||
workouttype__in=modalities,
|
||||
boattype__in=waterboattype,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate,
|
||||
@@ -2564,7 +2568,7 @@ def cum_flex_data(
|
||||
"script":script,
|
||||
"div":div,
|
||||
}
|
||||
|
||||
|
||||
return JSONResponse(data)
|
||||
|
||||
|
||||
@@ -2587,18 +2591,31 @@ def cum_flex(request,theuser=0,
|
||||
'rankingonly':False,
|
||||
}):
|
||||
|
||||
if 'options' in request.session:
|
||||
options = request.session['options']
|
||||
|
||||
try:
|
||||
workouttypes = options['workouttypes']
|
||||
except KeyError:
|
||||
workouttypes = [i[0] for i in types.workouttypes]
|
||||
r = getrequestrower(request,userid=theuser)
|
||||
theuser = r.user
|
||||
|
||||
if 'waterboattype' in request.session:
|
||||
waterboattype = request.session['waterboattype']
|
||||
else:
|
||||
waterboattype = types.waterboattype
|
||||
|
||||
|
||||
if 'rankingonly' in request.session:
|
||||
rankingonly = request.session['rankingonly']
|
||||
else:
|
||||
rankingonly = False
|
||||
|
||||
if 'modalities' in request.session:
|
||||
modalities = request.session['modalities']
|
||||
if len(modalities) > 1:
|
||||
modality = 'all'
|
||||
else:
|
||||
modality = modalities[0]
|
||||
else:
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
modality = 'all'
|
||||
|
||||
try:
|
||||
includereststrokes = options['includereststrokes']
|
||||
except KeyError:
|
||||
includereststrokes = False
|
||||
|
||||
try:
|
||||
rankingonly = options['rankingonly']
|
||||
@@ -2606,15 +2623,15 @@ def cum_flex(request,theuser=0,
|
||||
rankingonly = False
|
||||
|
||||
try:
|
||||
waterboattype = options['waterboattype']
|
||||
includereststrokes = options['includereststrokes']
|
||||
except KeyError:
|
||||
waterboattype = types.waterboattype
|
||||
|
||||
includereststrokes = False
|
||||
|
||||
|
||||
workstrokesonly = not includereststrokes
|
||||
|
||||
|
||||
if deltadays>0:
|
||||
startdate = enddate-datetime.timedelta(days=int(deltadays))
|
||||
waterboattype = types.waterboattype
|
||||
|
||||
|
||||
if startdatestring != "":
|
||||
startdate = iso8601.parse_date(startdatestring)
|
||||
@@ -2627,24 +2644,6 @@ def cum_flex(request,theuser=0,
|
||||
enddate = startdate
|
||||
startdate = s
|
||||
|
||||
promember=0
|
||||
if theuser == 0:
|
||||
if 'rowerid' in request.session:
|
||||
try:
|
||||
r = Rower.objects.get(id=request.session['rowerid'])
|
||||
theuser = r.user.id
|
||||
except Rower.DoesNotExist:
|
||||
theuser = request.user.id
|
||||
else:
|
||||
theuser = request.user.id
|
||||
|
||||
|
||||
if not request.user.is_anonymous():
|
||||
r = getrower(request.user)
|
||||
result = request.user.is_authenticated() and ispromember(request.user)
|
||||
if result:
|
||||
promember=1
|
||||
|
||||
|
||||
# get all indoor rows of in date range
|
||||
|
||||
@@ -2662,7 +2661,7 @@ def cum_flex(request,theuser=0,
|
||||
startdate = s
|
||||
elif request.method == 'POST' and "datedelta" in request.POST:
|
||||
deltaform = DeltaDaysForm(request.POST)
|
||||
optionsform = StatsOptionsForm()
|
||||
optionsform = TrendFlexModalForm()
|
||||
if deltaform.is_valid():
|
||||
deltadays = deltaform.cleaned_data['deltadays']
|
||||
if deltadays != 0 and isinstance(deltadays, Number):
|
||||
@@ -2678,27 +2677,25 @@ def cum_flex(request,theuser=0,
|
||||
})
|
||||
else:
|
||||
form = DateRangeForm()
|
||||
optionsform = StatsOptionsForm()
|
||||
optionsform = TrendFlexModalForm()
|
||||
elif request.method == 'POST' and 'options' in request.POST:
|
||||
optionsform = StatsOptionsForm(request.POST)
|
||||
if optionsform.is_valid():
|
||||
includereststrokes = optionsform.cleaned_data['includereststrokes']
|
||||
rankingonly = optionsform.cleaned_data['rankingonly']
|
||||
workstrokesonly = not includereststrokes
|
||||
waterboattype = optionsform.cleaned_data['waterboattype']
|
||||
workouttypes = []
|
||||
for type in types.checktypes:
|
||||
if optionsform.cleaned_data[type]:
|
||||
workouttypes.append(type)
|
||||
|
||||
|
||||
options = {
|
||||
'includereststrokes':includereststrokes,
|
||||
'workouttypes':workouttypes,
|
||||
'waterboattype':waterboattype,
|
||||
'rankingonly':rankingonly,
|
||||
}
|
||||
request.session['options'] = options
|
||||
modalityform = TrendFlexModalForm(request.POST)
|
||||
if modalityform.is_valid():
|
||||
modality = modalityform.cleaned_data['modality']
|
||||
waterboattype = modalityform.cleaned_data['waterboattype']
|
||||
rankingonly = modalityform.cleaned_data['rankingonly']
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
else:
|
||||
modalities = [modality]
|
||||
|
||||
if modality != 'water':
|
||||
waterboattype = [b[0] for b in types.boattypes]
|
||||
|
||||
|
||||
request.session['modalities'] = modalities
|
||||
request.session['waterboattype'] = waterboattype
|
||||
request.session['rankingonly'] = rankingonly
|
||||
form = DateRangeForm(initial={
|
||||
'startdate': startdate,
|
||||
'enddate': enddate,
|
||||
@@ -2716,7 +2713,17 @@ def cum_flex(request,theuser=0,
|
||||
'enddate': enddate,
|
||||
})
|
||||
deltaform = DeltaDaysForm()
|
||||
optionsform = StatsOptionsForm()
|
||||
modalityform = TrendFlexModalForm()
|
||||
|
||||
negtypes = []
|
||||
for b in types.boattypes:
|
||||
if b[0] not in waterboattype:
|
||||
negtypes.append(b[0])
|
||||
|
||||
includereststrokes = False
|
||||
|
||||
workstrokesonly = not includereststrokes
|
||||
|
||||
|
||||
script = ''
|
||||
div = get_call()
|
||||
@@ -2728,54 +2735,56 @@ def cum_flex(request,theuser=0,
|
||||
noylist = ["time","distance"]
|
||||
axchoicesbasic.pop("cumdist")
|
||||
|
||||
# set options form correctly
|
||||
initial = {}
|
||||
initial['includereststrokes'] = includereststrokes
|
||||
initial['rankingonly'] = rankingonly
|
||||
initial['waterboattype'] = waterboattype
|
||||
|
||||
for wtype in types.checktypes:
|
||||
if wtype in workouttypes:
|
||||
initial[wtype] = True
|
||||
else:
|
||||
initial[wtype] = False
|
||||
|
||||
|
||||
try:
|
||||
u = User.objects.get(id=theuser)
|
||||
except User.DoesNotExist:
|
||||
u = ''
|
||||
|
||||
optionsform = StatsOptionsForm(initial=initial)
|
||||
modalityform = TrendFlexModalForm(
|
||||
initial={
|
||||
'modality':modality,
|
||||
'waterboattype':waterboattype,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
options['includereststrokes'] = includereststrokes
|
||||
options['rankingonly'] = includereststrokes
|
||||
options['workouttypes'] =workouttypes
|
||||
options['waterboattype'] =waterboattype
|
||||
options['theuser'] =theuser
|
||||
options['rankingonly'] = rankingonly
|
||||
options['xparam'] =xparam
|
||||
options['yparam1'] =yparam1
|
||||
options['yparam2'] =yparam2
|
||||
options['startdatestring'] = startdatestring
|
||||
options['enddatestring'] =enddatestring
|
||||
options['deltadays'] =deltadays
|
||||
|
||||
|
||||
options = {
|
||||
'xparam': xparam,
|
||||
'yparam1': yparam1,
|
||||
'yparam2': yparam2,
|
||||
'modality': modality,
|
||||
'theuser': theuser.id,
|
||||
'waterboattype':waterboattype,
|
||||
'startdatestring':startdatestring,
|
||||
'enddatestring':enddatestring,
|
||||
'deltadays':deltadays,
|
||||
'rankingonly':rankingonly,
|
||||
'includereststrokes':includereststrokes,
|
||||
}
|
||||
|
||||
request.session['options'] = options
|
||||
|
||||
promember=0
|
||||
mayedit=0
|
||||
if not request.user.is_anonymous():
|
||||
result = request.user.is_authenticated() and ispromember(request.user)
|
||||
if result:
|
||||
promember = 1
|
||||
|
||||
|
||||
request.session['options'] = options
|
||||
|
||||
|
||||
return render(request, 'cum_flex.html',
|
||||
{'interactiveplot':script,
|
||||
'the_div':div,
|
||||
'js_res': js_resources,
|
||||
'css_res':css_resources,
|
||||
'id':theuser,
|
||||
'theuser':u,
|
||||
'rower':r,
|
||||
'active':'nav-analysis',
|
||||
'theuser':theuser,
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
'form':form,
|
||||
'optionsform':optionsform,
|
||||
'optionsform':modalityform,
|
||||
'deltaform':deltaform,
|
||||
'xparam':xparam,
|
||||
'yparam1':yparam1,
|
||||
@@ -4966,13 +4975,6 @@ def workouts_join_select(request,
|
||||
except Rower.DoesNotExist:
|
||||
raise Http404("Rower doesn't exist")
|
||||
|
||||
# if 'startdate' in request.session:
|
||||
# startdate = iso8601.parse_date(request.session['startdate'])
|
||||
|
||||
|
||||
# if 'enddate' in request.session:
|
||||
# enddate = iso8601.parse_date(request.session['enddate'])
|
||||
|
||||
|
||||
if 'waterboattype' in request.session:
|
||||
waterboattype = request.session['waterboattype']
|
||||
@@ -5126,13 +5128,6 @@ def team_comparison_select(request,
|
||||
except Rower.DoesNotExist:
|
||||
raise Http404("Rower doesn't exist")
|
||||
|
||||
# if 'startdate' in request.session:
|
||||
# startdate = iso8601.parse_date(request.session['startdate'])
|
||||
|
||||
|
||||
# if 'enddate' in request.session:
|
||||
# enddate = iso8601.parse_date(request.session['enddate'])
|
||||
|
||||
|
||||
if 'waterboattype' in request.session:
|
||||
waterboattype = request.session['waterboattype']
|
||||
@@ -5965,12 +5960,6 @@ def user_boxplot_select(request,
|
||||
|
||||
waterboattype = types.waterboattype
|
||||
|
||||
# if 'startdate' in request.session:
|
||||
# startdate = iso8601.parse_date(request.session['startdate'])
|
||||
|
||||
|
||||
# if 'enddate' in request.session:
|
||||
# enddate = iso8601.parse_date(request.session['enddate'])
|
||||
|
||||
if startdatestring != "":
|
||||
startdate = iso8601.parse_date(startdatestring)
|
||||
@@ -5983,12 +5972,6 @@ def user_boxplot_select(request,
|
||||
enddate = startdate
|
||||
startdate = s
|
||||
|
||||
# if 'startdate' in request.session:
|
||||
# startdate = iso8601.parse_date(request.session['startdate'])
|
||||
|
||||
|
||||
# if 'enddate' in request.session:
|
||||
# enddate = iso8601.parse_date(request.session['enddate'])
|
||||
|
||||
if request.method == 'POST' and 'daterange' in request.POST:
|
||||
dateform = DateRangeForm(request.POST)
|
||||
|
||||
Reference in New Issue
Block a user