better modality form in multi compare
This commit is contained in:
@@ -540,7 +540,7 @@ class TrendFlexModalForm(forms.Form):
|
||||
initial = types.waterboattype)
|
||||
rankingonly = forms.BooleanField(initial=False,
|
||||
label='Only Ranking Pieces',
|
||||
required=True)
|
||||
required=False)
|
||||
|
||||
|
||||
# This form sets options for the summary stats page
|
||||
|
||||
@@ -5112,6 +5112,10 @@ def team_comparison_select(request,
|
||||
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']
|
||||
@@ -5130,8 +5134,6 @@ def team_comparison_select(request,
|
||||
enddate = dateform.cleaned_data['enddate']
|
||||
startdatestring = startdate.strftime('%Y-%m-%d')
|
||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||
request.session['startdate'] = startdatestring
|
||||
request.session['enddate'] = enddatestring
|
||||
else:
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
@@ -5153,6 +5155,11 @@ def team_comparison_select(request,
|
||||
waterboattype = [b[0] for b in types.boattypes]
|
||||
|
||||
|
||||
if 'rankingonly' in modalityform.cleaned_data:
|
||||
rankingonly = modalityform.cleaned_data['rankingonly']
|
||||
else:
|
||||
rankingonly = False
|
||||
|
||||
request.session['modalities'] = modalities
|
||||
request.session['waterboattype'] = waterboattype
|
||||
|
||||
@@ -5203,6 +5210,9 @@ def team_comparison_select(request,
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities).order_by("-date", "-starttime").exclude(boattype__in=negtypes)
|
||||
|
||||
if rankingonly:
|
||||
workouts = [w for w in workouts if w.rankingpiece]
|
||||
|
||||
query = request.GET.get('q')
|
||||
if query:
|
||||
query_list = query.split()
|
||||
@@ -5224,7 +5234,8 @@ def team_comparison_select(request,
|
||||
chartform = ChartParamChoiceForm(initial={'teamid':0})
|
||||
modalityform = TrendFlexModalForm(initial={
|
||||
'modality':modality,
|
||||
'waterboattype':waterboattype
|
||||
'waterboattype':waterboattype,
|
||||
'rankingonly':rankingonly,
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user