added ranking selector
This commit is contained in:
@@ -1120,6 +1120,9 @@ class AnalysisOptionsForm(forms.Form):
|
||||
label='Water Boat Type',
|
||||
initial=mytypes.waterboattype)
|
||||
|
||||
ranking = forms.BooleanField(label='Ranking Workouts Only',
|
||||
initial=False,required=False)
|
||||
|
||||
|
||||
# form to select modality and boat type for trend flex
|
||||
class TrendFlexModalForm(forms.Form):
|
||||
|
||||
@@ -19,7 +19,8 @@ defaultoptions = {
|
||||
'includereststrokes': False,
|
||||
'workouttypes': ['rower', 'dynamic', 'slides'],
|
||||
'waterboattype': mytypes.waterboattype,
|
||||
'function': 'boxplot'
|
||||
'function': 'boxplot',
|
||||
'ranking': False,
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +73,11 @@ def analysis_new(request,
|
||||
modalities = [m[0] for m in mytypes.workouttypes_ordered.items()]
|
||||
modality = 'all'
|
||||
|
||||
try:
|
||||
ranking = options['ranking']
|
||||
except KeyError:
|
||||
ranking = False
|
||||
|
||||
try:
|
||||
worldclass = options['cpoverlay']
|
||||
except KeyError:
|
||||
@@ -109,6 +115,7 @@ def analysis_new(request,
|
||||
|
||||
modality = optionsform.cleaned_data['modality']
|
||||
waterboattype = optionsform.cleaned_data['waterboattype']
|
||||
ranking = optionsform.cleaned_data['ranking']
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in mytypes.workouttypes]
|
||||
else: # pragma: no cover
|
||||
@@ -118,6 +125,7 @@ def analysis_new(request,
|
||||
|
||||
options['modalities'] = modalities
|
||||
options['waterboattype'] = waterboattype
|
||||
options['ranking'] = ranking
|
||||
try:
|
||||
worldclass = options['cpoverlay']
|
||||
except KeyError:
|
||||
@@ -173,17 +181,24 @@ def analysis_new(request,
|
||||
if b[0] not in waterboattype: # pragma: no cover
|
||||
negtypes.append(b[0])
|
||||
|
||||
rankingtypes = [False,True]
|
||||
if ranking:
|
||||
rankingtypes = [True]
|
||||
|
||||
|
||||
if theteam is not None and (theteam.viewing == 'allmembers' or theteam.manager == request.user): # pragma: no cover
|
||||
workouts = Workout.objects.filter(team=theteam,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities,
|
||||
rankingpiece__in=rankingtypes,
|
||||
)
|
||||
elif theteam is not None and theteam.viewing == 'coachonly': # pragma: no cover
|
||||
workouts = Workout.objects.filter(team=theteam, user=r,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities,
|
||||
rankingpiece__in=rankingtypes,
|
||||
)
|
||||
elif thesession is not None:
|
||||
workouts = get_workouts_session(r, thesession)
|
||||
@@ -192,6 +207,7 @@ def analysis_new(request,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities,
|
||||
rankingpiece__in=rankingtypes,
|
||||
)
|
||||
if firstworkout:
|
||||
workouts = firstworkoutquery | workouts
|
||||
@@ -229,6 +245,7 @@ def analysis_new(request,
|
||||
optionsform = AnalysisOptionsForm(initial={
|
||||
'modality': modality,
|
||||
'waterboattype': waterboattype,
|
||||
'ranking': ranking,
|
||||
})
|
||||
|
||||
if r.birthdate:
|
||||
|
||||
Reference in New Issue
Block a user