diff --git a/rowers/forms.py b/rowers/forms.py index bd7c7ae1..e45bdf84 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -531,7 +531,7 @@ class TrendFlexModalForm(forms.Form): class StatsOptionsForm(forms.Form): includereststrokes = forms.BooleanField(initial=False,label='Include Rest Strokes',required=False) rankingonly = forms.BooleanField(initial=False, - label='Only Ranking Pieces',required=True) + label='Only Ranking Pieces',required=False) water = forms.BooleanField(initial=False,required=False) waterboattype = forms.MultipleChoiceField(choices=boattypes, label='Water Boat Type', diff --git a/rowers/views.py b/rowers/views.py index c717e866..b17366b6 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -5870,7 +5870,8 @@ def user_multiflex_select(request, modalityform = TrendFlexModalForm(initial={ 'modality':modality, - 'waterboattype':waterboattype + 'waterboattype':waterboattype, + 'rankingonly':rankingonly, }) messages.info(request,successmessage) @@ -5881,6 +5882,11 @@ def user_multiflex_select(request, request.session['startdate'] = startdatestring request.session['enddate'] = enddatestring + request.session['waterboattype'] = waterboattype + request.session['rankingonly'] = rankingonly + request.session['modalities'] = modalities + + return render(request, 'user_multiflex_select.html', {'workouts': workouts, 'dateform':dateform, @@ -6353,12 +6359,14 @@ def user_boxplot_select(request, for type in types.checktypes: if optionsform.cleaned_data[type]: workouttypes.append(type) - + options = { 'workouttypes':workouttypes, 'waterboattype':waterboattype, 'rankingonly':rankingonly, } + + request.session['options'] = options @@ -6434,6 +6442,7 @@ def user_boxplot_select(request, # set options form correctly initial = {} initial['waterboattype'] = waterboattype + initial['rankingonly'] = rankingonly for wtype in types.checktypes: if wtype in workouttypes: @@ -6441,6 +6450,7 @@ def user_boxplot_select(request, else: initial[wtype] = False + optionsform = StatsOptionsForm(initial=initial) messages.info(request,successmessage) @@ -6564,6 +6574,7 @@ def boxplot_view_data(request,userid=0, def boxplot_view(request,userid=0, options={ 'includereststrokes':False, + 'rankingonly':False, }): if 'options' in request.session: @@ -6574,6 +6585,12 @@ def boxplot_view(request,userid=0, except KeyError: includereststrokes = False options['includereststrokes'] = False + + try: + rankingonly = options['rankingonly'] + except KeyError: + rankingonly = False + options['rankingonly'] = False workstrokesonly = not includereststrokes @@ -6631,6 +6648,7 @@ def boxplot_view(request,userid=0, options['ids'] = ids options['userid'] = userid options['plotfield'] = plotfield + options['rankingonly'] = rankingonly request.session['options'] = options @@ -8044,6 +8062,7 @@ def cumstats(request,theuser=0, initial = {} initial['includereststrokes'] = includereststrokes initial['waterboattype'] = waterboattype + initial['rankingonly'] = rankingonly for wtype in types.checktypes: if wtype in workouttypes: