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