Private
Public Access
1
0

added boat type selector to stats and flexall

This commit is contained in:
Sander Roosendaal
2017-08-04 13:07:59 +02:00
parent e673255f43
commit 981075fd68
4 changed files with 128 additions and 8 deletions

View File

@@ -2097,7 +2097,8 @@ def cum_flex(request,theuser=0,
enddatestring="",
options={
'includereststrokes':False,
'workouttypes':['rower','dynamic','slides']
'workouttypes':['rower','dynamic','slides'],
'waterboattype':['1x','2x','2-','4x','4-','8+']
}):
if 'options' in request.session:
@@ -2108,6 +2109,7 @@ def cum_flex(request,theuser=0,
workstrokesonly = not includereststrokes
checktypes = ['water','rower','dynamic','slides','skierg',
'paddle','snow','coastal','other']
waterboattype = ['1x','2x','2-','4x','4-','8+']
if deltadays>0:
startdate = enddate-datetime.timedelta(days=int(deltadays))
@@ -2174,6 +2176,7 @@ def cum_flex(request,theuser=0,
if optionsform.is_valid():
includereststrokes = optionsform.cleaned_data['includereststrokes']
workstrokesonly = not includereststrokes
waterboattype = optionsform.cleaned_data['waterboattype']
workouttypes = []
for type in checktypes:
if optionsform.cleaned_data[type]:
@@ -2182,6 +2185,7 @@ def cum_flex(request,theuser=0,
options = {
'includereststrokes':includereststrokes,
'workouttypes':workouttypes,
'waterboattype':waterboattype,
}
form = DateRangeForm(initial={
'startdate': startdate,
@@ -2205,6 +2209,7 @@ def cum_flex(request,theuser=0,
r2 = getrower(theuser)
allworkouts = Workout.objects.filter(user=r2,
workouttype__in=workouttypes,
boattype__in=waterboattype,
startdatetime__gte=startdate,
startdatetime__lte=enddate)
@@ -2242,6 +2247,8 @@ def cum_flex(request,theuser=0,
initial = {}
initial['includereststrokes'] = includereststrokes
initial['waterboattype'] = waterboattype
for wtype in checktypes:
if wtype in workouttypes:
initial[wtype] = True
@@ -4934,7 +4941,8 @@ def cumstats(request,theuser=0,
plotfield='spm',
options={
'includereststrokes':False,
'workouttypes':['rower','dynamic','slides']
'workouttypes':['rower','dynamic','slides'],
'waterboattype':['1x','2x','2-','4x','4-','8+']
}):
if 'options' in request.session:
@@ -4945,6 +4953,7 @@ def cumstats(request,theuser=0,
workstrokesonly = not includereststrokes
checktypes = ['water','rower','dynamic','slides','skierg',
'paddle','snow','other','coastal']
waterboattype = ['1x','2x','2-','4x','4-','8+']
if deltadays>0:
startdate = enddate-datetime.timedelta(days=int(deltadays))
@@ -5011,6 +5020,7 @@ def cumstats(request,theuser=0,
includereststrokes = optionsform.cleaned_data['includereststrokes']
workstrokesonly = not includereststrokes
workouttypes = []
waterboattype = optionsform.cleaned_data['waterboattype']
for type in checktypes:
if optionsform.cleaned_data[type]:
workouttypes.append(type)
@@ -5018,6 +5028,7 @@ def cumstats(request,theuser=0,
options = {
'includereststrokes':includereststrokes,
'workouttypes':workouttypes,
'waterboattype':waterboattype,
}
form = DateRangeForm()
deltaform = DeltaDaysForm()
@@ -5036,6 +5047,7 @@ def cumstats(request,theuser=0,
r2 = getrower(theuser)
allergworkouts = Workout.objects.filter(user=r2,
workouttype__in=workouttypes,
boattype__in=waterboattype,
startdatetime__gte=startdate,
startdatetime__lte=enddate)
@@ -5137,6 +5149,7 @@ def cumstats(request,theuser=0,
# set options form correctly
initial = {}
initial['includereststrokes'] = includereststrokes
initial['waterboattype'] = waterboattype
for wtype in checktypes:
if wtype in workouttypes: