diff --git a/rowers/forms.py b/rowers/forms.py index 8dce9f6d..4a5df3d8 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -1111,6 +1111,7 @@ class PowerIntervalUpdateForm(forms.Form): boattypes = mytypes.boattypes +ergtypes = mytypes.ergtypes workouttypes = mytypes.workouttypes ww = list(workouttypes) ww.append(tuple(('all', 'All'))) @@ -1143,7 +1144,7 @@ class AnalysisOptionsForm(forms.Form): modality = forms.ChoiceField(choices=workouttypes, label='Workout Type', initial='all') - waterboattype = forms.MultipleChoiceField(choices=boattypes, + waterboattype = forms.MultipleChoiceField(choices=boattypes+ergtypes, label='Water Boat Type', initial=mytypes.waterboattype) diff --git a/rowers/models.py b/rowers/models.py index 32e2870d..b46f727a 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -3582,7 +3582,7 @@ class Workout(models.Model): boattype = self.boattype workouttype = self.workouttype - if workouttype != 'water': + if workouttype not in ['water','rower']: try: stri = u'{d} {n} {dist}m {duration} {workouttype} {ownerfirst} {ownerlast}'.format( d=date.strftime('%Y-%m-%d'), diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py index cf41c4a3..38b7ec34 100644 --- a/rowers/views/analysisviews.py +++ b/rowers/views/analysisviews.py @@ -100,6 +100,11 @@ def analysis_new(request, waterboattype = mytypes.waterboattype + try: + waterboattype = options['waterboattype'] + except KeyError: + pass + if request.method == 'POST': thediv = get_call() dateform = DateRangeForm(request.POST) @@ -122,7 +127,7 @@ def analysis_new(request, modalities = [m[0] for m in mytypes.workouttypes] else: # pragma: no cover modalities = [modality] - if modality != 'water': + if modality not in ['water','rower']: waterboattype = [b[0] for b in mytypes.boattypes] options['modalities'] = modalities @@ -133,7 +138,7 @@ def analysis_new(request, except KeyError: worldclass = False options['cpoverlay'] = worldclass - + chartform = AnalysisChoiceForm(request.POST) if chartform.is_valid(): options['form'] = chartform.cleaned_data @@ -160,6 +165,9 @@ def analysis_new(request, for b in mytypes.boattypes: if b[0] not in waterboattype: # pragma: no cover negtypes.append(b[0]) + for b in mytypes.ergtypes: + if b[0] not in waterboattype: # pragma: no cover + negtypes.append(b[0]) startdate = datetime.datetime.combine(startdate, datetime.time()) enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59)) @@ -179,11 +187,6 @@ def analysis_new(request, except (ValueError, AttributeError): # pragma: no cover pass - negtypes = [] - for b in mytypes.boattypes: - if b[0] not in waterboattype: # pragma: no cover - negtypes.append(b[0]) - rankingtypes = [False,True] if ranking: rankingtypes = [True]