Private
Public Access
1
0

flexall done

some details not 100%
This commit is contained in:
Sander Roosendaal
2018-10-05 16:58:50 +02:00
parent 7dd551df70
commit 159a0416d0
5 changed files with 365 additions and 299 deletions

View File

@@ -1,35 +1,16 @@
{% extends "base.html" %} {% extends "newbase.html" %}
{% load staticfiles %} {% load staticfiles %}
{% load rowerfilters %} {% load rowerfilters %}
{% block title %}Rowsandall {% endblock %} {% block title %}Rowsandall {% endblock %}
{% block content %} {% block main %}
<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>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script> <script>
$(function() { $(function() {
// Get the form fields and hidden div // Get the form fields and hidden div
var checkbox = $("#id_water"); var modality = $("#id_modality");
var hidden = $("#id_waterboattype"); var hidden = $("#id_waterboattype");
@@ -43,11 +24,12 @@
// Setup an event listener for when the state of the // Setup an event listener for when the state of the
// checkbox changes. // checkbox changes.
checkbox.change(function() { modality.change(function() {
// Check to see if the checkbox is checked. // Check to see if the checkbox is checked.
// If it is, show the fields and populate the input. // If it is, show the fields and populate the input.
// If not, hide the fields. // If not, hide the fields.
if (checkbox.is(':checked')) { var Value = modality.val();
if (Value=='water') {
// Show the hidden fields. // Show the hidden fields.
hidden.show(); hidden.show();
} else { } else {
@@ -74,173 +56,170 @@
</script> </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 id="id_script">
</div> </div>
<style> <ul class="main-content">
/* Need this to get the page in "desktop mode"; not having an infinite height.*/ <li class="grid_2">
html, body {height: 100%; margin:5px;}
</style>
<div id="title" class="grid_12 alpha">
<div class="grid_10 alpha">
&nbsp;
</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 %}
&nbsp;
{% endif %}
</div>
</div>
<div class="grid_12 alpha">
<div id="form" class="grid_6 alpha">
<form enctype="multipart/form-data" action="{{ formloc }}" method="post"> <form enctype="multipart/form-data" action="{{ formloc }}" method="post">
{% csrf_token %} {% csrf_token %}
<div class="grid_2 alpha">
<table> <table>
{{ optionsform.as_table }} {{ optionsform.as_table }}
</table> </table>
</div> <input type="hidden" name="options" value="options">
<div class="grid_2 suffix_2 omega"> <input class="button green small" value="Submit" type="Submit">
<input type="hidden" name="options" value="options">
<input class="grid_1 alpha button green small" value="Submit" type="Submit">
</div>
</form> </form>
</div> </li>
<div class="grid_6 omega"> <li class="grid_2">
<p>Use this form to select a different date range:</p> <p>Use this form to select a different date range:</p>
<p> <p>
Select start and end date for a date range: 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> <table>
{{ form.as_table }} {{ form.as_table }}
</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">
{% csrf_token %} {% csrf_token %}
<input name='datedelta' class="button green" type="submit" value="Submit"> <input name='daterange' class="button green" type="submit" value="Submit">
</form> </form>
</div> </li>
</div>
</div>
<div id="summary" class="grid_6 suffix_6 alpha"> <li>
<p>Summary for {{ theuser.first_name }} {{ theuser.last_name }}
<p>Summary for {{ theuser.first_name }} {{ theuser.last_name }} between {{ startdate|date }} and {{ enddate|date }}</p>
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"> {{ the_div|safe }}
<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>
</li>
<div class="grid_2 dropdown"> </ul>
<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>
{% endblock %} {% endblock %}
@@ -253,16 +232,25 @@
$(function($) { $(function($) {
console.log('loading script'); console.log('loading script');
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/flexalldata', function(json) { $.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/flexalldata', function(json) {
console.log('got script');
var counter=0; var counter=0;
var script = json.script; var script = json.script;
var div = json.div; var div = json.div;
console.log('set vars');
$("#id_sitready").remove(); $("#id_sitready").remove();
console.log('sitready removed');
$("#id_chart").append(div); $("#id_chart").append(div);
console.log(div); console.log('div appended');
$("#id_script").append("<script>"+script+"</s"+"cript>"); $("#id_script").append("<script>"+script+"</s"+"cript>");
console.log('script changed');
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}
{% block sidebar %}
{% include 'menu_analytics.html' %}
{% endblock %}

View File

@@ -291,3 +291,6 @@
{% endblock %} {% endblock %}
{% block sidebar %}
{% include 'menu_racing.html' %}
{% endblock %}

View File

@@ -208,11 +208,11 @@ urlpatterns = [
url(r'^ote-ranking/(?P<deltadays>\d+)$',views.oterankings_view), url(r'^ote-ranking/(?P<deltadays>\d+)$',views.oterankings_view),
url(r'^ote-ranking/$',views.oterankings_view), url(r'^ote-ranking/$',views.oterankings_view),
url(r'^ote-ranking/user/(?P<theuser>\d+)/$',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+.*)/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+.*)/(?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+.*)/$',views.cum_flex),
url(r'^flexall/user/(?P<theuser>\d+)/$',views.cum_flex),
url(r'^flexall/$',views.cum_flex), url(r'^flexall/$',views.cum_flex),
url(r'^flexalldata/$',views.cum_flex_data), url(r'^flexalldata/$',views.cum_flex_data),
url(r'^histo/u/(?P<theuser>\d+)$',views.histo), url(r'^histo/u/(?P<theuser>\d+)$',views.histo),

View File

@@ -2455,7 +2455,7 @@ def cum_flex_data(
options={ options={
'includereststrokes':False, 'includereststrokes':False,
'rankingonly':False, 'rankingonly':False,
'workouttypes':[i[0] for i in types.workouttypes], 'modality':'all',
'waterboattype':types.waterboattype, 'waterboattype':types.waterboattype,
'theuser':0, 'theuser':0,
'xparam':'spm', 'xparam':'spm',
@@ -2472,7 +2472,7 @@ def cum_flex_data(
options = request.session['options'] options = request.session['options']
try: try:
workouttypes = options['workouttypes'] modality = options['modality']
rankingonly = options['rankingonly'] rankingonly = options['rankingonly']
includereststrokes = options['includereststrokes'] includereststrokes = options['includereststrokes']
waterboattype = options['waterboattype'] waterboattype = options['waterboattype']
@@ -2485,7 +2485,7 @@ def cum_flex_data(
enddatestring = options['enddatestring'] enddatestring = options['enddatestring']
deltadays = options['deltadays'] deltadays = options['deltadays']
except KeyError: except KeyError:
workouttypes = def_options['workouttypes'] modality = def_options['modality']
rankingonly = def_options['rankingonly'] rankingonly = def_options['rankingonly']
includereststrokes = def_options['includereststrokes'] includereststrokes = def_options['includereststrokes']
waterboattype = def_options['waterboattype'] waterboattype = def_options['waterboattype']
@@ -2500,6 +2500,10 @@ def cum_flex_data(
request.session['options'] = def_options request.session['options'] = def_options
if modality == 'all':
modalities = [m[0] for m in types.workouttypes]
else:
modalities = [modality]
try: try:
startdate = iso8601.parse_date(startdatestring) startdate = iso8601.parse_date(startdatestring)
@@ -2538,7 +2542,7 @@ def cum_flex_data(
rankingpiece = [True,False] rankingpiece = [True,False]
allworkouts = Workout.objects.filter(user=r2, allworkouts = Workout.objects.filter(user=r2,
workouttype__in=workouttypes, workouttype__in=modalities,
boattype__in=waterboattype, boattype__in=waterboattype,
startdatetime__gte=startdate, startdatetime__gte=startdate,
startdatetime__lte=enddate, startdatetime__lte=enddate,
@@ -2564,7 +2568,7 @@ def cum_flex_data(
"script":script, "script":script,
"div":div, "div":div,
} }
return JSONResponse(data) return JSONResponse(data)
@@ -2587,18 +2591,31 @@ def cum_flex(request,theuser=0,
'rankingonly':False, 'rankingonly':False,
}): }):
if 'options' in request.session:
options = request.session['options']
try: r = getrequestrower(request,userid=theuser)
workouttypes = options['workouttypes'] theuser = r.user
except KeyError:
workouttypes = [i[0] for i in types.workouttypes] 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: try:
rankingonly = options['rankingonly'] rankingonly = options['rankingonly']
@@ -2606,15 +2623,15 @@ def cum_flex(request,theuser=0,
rankingonly = False rankingonly = False
try: try:
waterboattype = options['waterboattype'] includereststrokes = options['includereststrokes']
except KeyError: except KeyError:
waterboattype = types.waterboattype includereststrokes = False
workstrokesonly = not includereststrokes workstrokesonly = not includereststrokes
waterboattype = types.waterboattype
if deltadays>0:
startdate = enddate-datetime.timedelta(days=int(deltadays))
if startdatestring != "": if startdatestring != "":
startdate = iso8601.parse_date(startdatestring) startdate = iso8601.parse_date(startdatestring)
@@ -2627,24 +2644,6 @@ def cum_flex(request,theuser=0,
enddate = startdate enddate = startdate
startdate = s 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 # get all indoor rows of in date range
@@ -2662,7 +2661,7 @@ 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() optionsform = TrendFlexModalForm()
if deltaform.is_valid(): if deltaform.is_valid():
deltadays = deltaform.cleaned_data['deltadays'] deltadays = deltaform.cleaned_data['deltadays']
if deltadays != 0 and isinstance(deltadays, Number): if deltadays != 0 and isinstance(deltadays, Number):
@@ -2678,27 +2677,25 @@ def cum_flex(request,theuser=0,
}) })
else: else:
form = DateRangeForm() form = DateRangeForm()
optionsform = StatsOptionsForm() optionsform = TrendFlexModalForm()
elif request.method == 'POST' and 'options' in request.POST: elif request.method == 'POST' and 'options' in request.POST:
optionsform = StatsOptionsForm(request.POST) modalityform = TrendFlexModalForm(request.POST)
if optionsform.is_valid(): if modalityform.is_valid():
includereststrokes = optionsform.cleaned_data['includereststrokes'] modality = modalityform.cleaned_data['modality']
rankingonly = optionsform.cleaned_data['rankingonly'] waterboattype = modalityform.cleaned_data['waterboattype']
workstrokesonly = not includereststrokes rankingonly = modalityform.cleaned_data['rankingonly']
waterboattype = optionsform.cleaned_data['waterboattype'] if modality == 'all':
workouttypes = [] modalities = [m[0] for m in types.workouttypes]
for type in types.checktypes: else:
if optionsform.cleaned_data[type]: modalities = [modality]
workouttypes.append(type)
if modality != 'water':
waterboattype = [b[0] for b in types.boattypes]
options = {
'includereststrokes':includereststrokes,
'workouttypes':workouttypes, request.session['modalities'] = modalities
'waterboattype':waterboattype, request.session['waterboattype'] = waterboattype
'rankingonly':rankingonly, request.session['rankingonly'] = rankingonly
}
request.session['options'] = options
form = DateRangeForm(initial={ form = DateRangeForm(initial={
'startdate': startdate, 'startdate': startdate,
'enddate': enddate, 'enddate': enddate,
@@ -2716,7 +2713,17 @@ def cum_flex(request,theuser=0,
'enddate': enddate, 'enddate': enddate,
}) })
deltaform = DeltaDaysForm() 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 = '' script = ''
div = get_call() div = get_call()
@@ -2728,54 +2735,56 @@ def cum_flex(request,theuser=0,
noylist = ["time","distance"] noylist = ["time","distance"]
axchoicesbasic.pop("cumdist") axchoicesbasic.pop("cumdist")
# set options form correctly
initial = {}
initial['includereststrokes'] = includereststrokes
initial['rankingonly'] = rankingonly
initial['waterboattype'] = waterboattype
for wtype in types.checktypes: modalityform = TrendFlexModalForm(
if wtype in workouttypes: initial={
initial[wtype] = True 'modality':modality,
else: 'waterboattype':waterboattype,
initial[wtype] = False }
)
try:
u = User.objects.get(id=theuser)
except User.DoesNotExist:
u = ''
optionsform = StatsOptionsForm(initial=initial)
options['includereststrokes'] = includereststrokes
options['rankingonly'] = includereststrokes options = {
options['workouttypes'] =workouttypes 'xparam': xparam,
options['waterboattype'] =waterboattype 'yparam1': yparam1,
options['theuser'] =theuser 'yparam2': yparam2,
options['rankingonly'] = rankingonly 'modality': modality,
options['xparam'] =xparam 'theuser': theuser.id,
options['yparam1'] =yparam1 'waterboattype':waterboattype,
options['yparam2'] =yparam2 'startdatestring':startdatestring,
options['startdatestring'] = startdatestring 'enddatestring':enddatestring,
options['enddatestring'] =enddatestring 'deltadays':deltadays,
options['deltadays'] =deltadays 'rankingonly':rankingonly,
'includereststrokes':includereststrokes,
}
request.session['options'] = options 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', return render(request, 'cum_flex.html',
{'interactiveplot':script, {'interactiveplot':script,
'the_div':div, 'the_div':div,
'js_res': js_resources, 'js_res': js_resources,
'css_res':css_resources, 'css_res':css_resources,
'id':theuser, 'id':theuser,
'theuser':u, 'rower':r,
'active':'nav-analysis',
'theuser':theuser,
'startdate':startdate, 'startdate':startdate,
'enddate':enddate, 'enddate':enddate,
'form':form, 'form':form,
'optionsform':optionsform, 'optionsform':modalityform,
'deltaform':deltaform, 'deltaform':deltaform,
'xparam':xparam, 'xparam':xparam,
'yparam1':yparam1, 'yparam1':yparam1,
@@ -4966,13 +4975,6 @@ def workouts_join_select(request,
except Rower.DoesNotExist: except Rower.DoesNotExist:
raise Http404("Rower doesn't exist") 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: if 'waterboattype' in request.session:
waterboattype = request.session['waterboattype'] waterboattype = request.session['waterboattype']
@@ -5126,13 +5128,6 @@ def team_comparison_select(request,
except Rower.DoesNotExist: except Rower.DoesNotExist:
raise Http404("Rower doesn't exist") 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: if 'waterboattype' in request.session:
waterboattype = request.session['waterboattype'] waterboattype = request.session['waterboattype']
@@ -5965,12 +5960,6 @@ def user_boxplot_select(request,
waterboattype = types.waterboattype 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 != "": if startdatestring != "":
startdate = iso8601.parse_date(startdatestring) startdate = iso8601.parse_date(startdatestring)
@@ -5983,12 +5972,6 @@ def user_boxplot_select(request,
enddate = startdate enddate = startdate
startdate = s 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: if request.method == 'POST' and 'daterange' in request.POST:
dateform = DateRangeForm(request.POST) dateform = DateRangeForm(request.POST)

View File

@@ -223,6 +223,98 @@
display: block; display: block;
} }
main .cd-accordion-menu {
width: 100%;
max-width: 600px;
background: #27aae2;
padding-left: 30px;
padding-bottom: 0px;
}
main .cd-accordion-menu ul {
/* by default hide all sub menus */
display: none;
}
main .cd-accordion-menu li {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
main .cd-accordion-menu input[type=checkbox] {
/* hide native checkbox */
position: absolute;
opacity: 0;
}
main .cd-accordion-menu label,
main .cd-accordion-menu a {
position: relative;
display: block;
color: #fff;
}
main ul label:hover,
main ul ul label:hover,
main ul ul a:hover,
main ul ul ul label:hover,
main ul ul ul a:hover {
background: #1c74bb;
}
main .cd-accordion-menu a::before {
content: '\00a0';
width: 16px;
height: 16px;
display: inline-block;
font-size: inherit;
text-rendering: auto;
}
main .cd-accordion-menu label::before
{
/* icons */
font: normal normal normal 1.0em/1 FontAwesome;
font-size: inherit;
text-rendering: auto;
content: '\f0da';
display: inline-block;
width: 16px;
height: 16px;
-webkit-transform: translateY(0%);
-moz-transform: translateY(0%);
-ms-transform: translateY(0%);
-o-transform: translateY(0%);
transform: translateY(0%);
}
main .cd-accordion-menu label {
cursor: pointer;
background: #27aae2;
}
main .cd-accordion-menu input[type=checkbox]:checked + label::before {
/* rotate arrow */
-webkit-transform: translateY(20%) rotate(90deg);
-moz-transform: translateY(20%) rotate(90deg);
-ms-transform: translateY(20%) rotate(90deg);
-o-transform: translateY(20%) rotate(90deg);
transform: translateY(20%) rotate(90deg);
}
main .cd-accordion-menu input[type=checkbox]:checked + label + ul,
main .cd-accordion-menu input[type=checkbox]:checked + label:nth-of-type(n) + ul {
/* use label:nth-of-type(n) to fix a bug on safari (<= 8.0.8) with multiple adjacent-sibling selectors*/
/* show children when item is checked */
display: block;
}
user ul { user ul {