fix #459
This commit is contained in:
@@ -20,11 +20,17 @@ def histo(request,theuser=0,
|
||||
'workouttypes':[i[0] for i in mytypes.workouttypes],
|
||||
'waterboattype':mytypes.waterboattype,
|
||||
'rankingonly': False,
|
||||
'histoparam':'power'
|
||||
}):
|
||||
|
||||
r = getrequestrower(request,userid=theuser)
|
||||
theuser = r.user
|
||||
|
||||
|
||||
if 'histoparam' in request.session:
|
||||
histoparam = request.session['histoparam']
|
||||
else:
|
||||
histoparam = 'power'
|
||||
|
||||
if 'waterboattype' in request.session:
|
||||
waterboattype = request.session['waterboattype']
|
||||
else:
|
||||
@@ -81,6 +87,7 @@ def histo(request,theuser=0,
|
||||
if request.method == 'POST':
|
||||
form = DateRangeForm(request.POST)
|
||||
modalityform = TrendFlexModalForm(request.POST)
|
||||
histoform = HistoForm(request.POST)
|
||||
if form.is_valid():
|
||||
startdate = form.cleaned_data['startdate']
|
||||
enddate = form.cleaned_data['enddate']
|
||||
@@ -110,6 +117,11 @@ def histo(request,theuser=0,
|
||||
'startdate': startdate,
|
||||
'enddate': enddate,
|
||||
})
|
||||
if histoform.is_valid():
|
||||
includereststrokes = histoform.cleaned_data['includereststrokes']
|
||||
histoparam = histoform.cleaned_data['histoparam']
|
||||
request.session['histoparam'] = histoparam
|
||||
request.session['includereststrokes'] = includereststrokes
|
||||
else:
|
||||
form = DateRangeForm(initial={
|
||||
'startdate': startdate,
|
||||
@@ -125,6 +137,10 @@ def histo(request,theuser=0,
|
||||
'rankingonly':rankingonly,
|
||||
}
|
||||
)
|
||||
histoform = HistoForm(initial={
|
||||
'includereststrokes':False,
|
||||
'histoparam':histoparam
|
||||
})
|
||||
|
||||
negtypes = []
|
||||
for b in mytypes.boattypes:
|
||||
@@ -149,6 +165,7 @@ def histo(request,theuser=0,
|
||||
'enddatestring':enddatestring,
|
||||
'rankingonly':rankingonly,
|
||||
'includereststrokes':includereststrokes,
|
||||
'histoparam':histoparam,
|
||||
}
|
||||
|
||||
request.session['options'] = options
|
||||
@@ -163,9 +180,21 @@ def histo(request,theuser=0,
|
||||
|
||||
request.session['options'] = options
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':'/rowers/analysis',
|
||||
'name':'Analysis'
|
||||
},
|
||||
{
|
||||
'url':reverse('histo'),
|
||||
'name': 'Histogram'
|
||||
}
|
||||
]
|
||||
|
||||
return render(request, 'histo.html',
|
||||
{'interactiveplot':script,
|
||||
'the_div':div,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'id':theuser,
|
||||
'active':'nav-analysis',
|
||||
'theuser':theuser,
|
||||
@@ -174,6 +203,7 @@ def histo(request,theuser=0,
|
||||
'enddate':enddate,
|
||||
'form':form,
|
||||
'optionsform':modalityform,
|
||||
'histoform':histoform,
|
||||
'teams':get_my_teams(request.user),
|
||||
})
|
||||
|
||||
@@ -295,6 +325,7 @@ def histo_data(
|
||||
'enddatestring':timezone.now().strftime("%Y-%m-%d"),
|
||||
'startdatestring':(timezone.now()-datetime.timedelta(days=30)).strftime("%Y-%m-%d"),
|
||||
'deltadays':-1,
|
||||
'histoparam':'power',
|
||||
}):
|
||||
|
||||
def_options = options
|
||||
@@ -311,6 +342,7 @@ def histo_data(
|
||||
theuser = keyvalue_get_default('theuser',options,def_options)
|
||||
startdatestring = keyvalue_get_default('startdatestring',options,def_options)
|
||||
enddatestring = keyvalue_get_default('enddatestring',options,def_options)
|
||||
histoparam = keyvalue_get_default('histoparam',options,def_options)
|
||||
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in mytypes.workouttypes]
|
||||
@@ -358,7 +390,7 @@ def histo_data(
|
||||
rankingpiece__in=rankingpiece)
|
||||
|
||||
if allworkouts:
|
||||
res = interactive_histoall(allworkouts)
|
||||
res = interactive_histoall(allworkouts,histoparam,includereststrokes)
|
||||
script = res[0]
|
||||
div = res[1]
|
||||
else:
|
||||
|
||||
@@ -48,7 +48,7 @@ from django.http import (
|
||||
)
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
from rowers.forms import (
|
||||
ForceCurveOptionsForm,
|
||||
ForceCurveOptionsForm,HistoForm,
|
||||
LoginForm,DocumentsForm,UploadOptionsForm,ImageForm,CourseForm,
|
||||
TeamUploadOptionsForm,WorkFlowLeftPanelForm,WorkFlowMiddlePanelForm,
|
||||
WorkFlowLeftPanelElement,WorkFlowMiddlePanelElement,
|
||||
|
||||
Reference in New Issue
Block a user