Private
Public Access
1
0

fixing date selector bug

This commit is contained in:
Sander Roosendaal
2018-10-25 09:35:13 +02:00
parent 697149de63
commit f3ddad40bc

View File

@@ -2526,6 +2526,7 @@ def rower_process_testcallback(request):
def keyvalue_get_default(key,options,def_options):
try:
return options[key]
except KeyError:
@@ -2544,17 +2545,17 @@ def cum_flex_data(
'xparam':'spm',
'yparam1':'power',
'yparam2':'None',
'enddatestring':'',
'startdatestring':'',
'enddatestring':timezone.now().strftime("%Y-%m-%d"),
'startdatestring':(timezone.now()-datetime.timedelta(days=30)).strftime("%Y-%m-%d"),
'deltadays':-1,
}):
def_options = options
if 'options' in request.session:
options = request.session['options']
modality = keyvalue_get_default('modality',options,def_options)
rankingonly = keyvalue_get_default('rankingonly',options,def_options)
includereststrokes = keyvalue_get_default('includereststrokes',options,def_options)
@@ -2567,6 +2568,7 @@ def cum_flex_data(
startdatestring = keyvalue_get_default('startdatestring',options,def_options)
enddatestring = keyvalue_get_default('enddatestring',options,def_options)
if modality == 'all':
modalities = [m[0] for m in mytypes.workouttypes]
else:
@@ -2604,7 +2606,7 @@ def cum_flex_data(
rankingpiece = [True,]
else:
rankingpiece = [True,False]
allworkouts = Workout.objects.filter(user=r2,
workouttype__in=modalities,
boattype__in=waterboattype,
@@ -2645,8 +2647,8 @@ def histo_data(
'modality':'all',
'waterboattype':mytypes.waterboattype,
'theuser':0,
'enddatestring':'',
'startdatestring':'',
'enddatestring':timezone.now().strftime("%Y-%m-%d"),
'startdatestring':(timezone.now()-datetime.timedelta(days=30)).strftime("%Y-%m-%d"),
'deltadays':-1,
}):
@@ -2739,8 +2741,8 @@ def cum_flex(request,theuser=0,
startdate=timezone.now()-datetime.timedelta(days=10),
enddate=timezone.now(),
deltadays=-1,
startdatestring="",
enddatestring="",
enddatestring=timezone.now().strftime("%Y-%m-%d"),
startdatestring=(timezone.now()-datetime.timedelta(days=30)).strftime("%Y-%m-%d"),
options={
'includereststrokes':False,
'workouttypes':[i[0] for i in mytypes.workouttypes],
@@ -2816,6 +2818,8 @@ def cum_flex(request,theuser=0,
s = enddate
enddate = startdate
startdate = s
startdatestring = startdate.strftime('%Y-%m-%d')
enddatestring = enddate.strftime('%Y-%m-%d')
if modalityform.is_valid():
modality = modalityform.cleaned_data['modality']
waterboattype = modalityform.cleaned_data['waterboattype']
@@ -3112,14 +3116,14 @@ def histo(request,theuser=0,
startdate=timezone.now()-datetime.timedelta(days=365),
enddate=timezone.now(),
deltadays=-1,
startdatestring="",
enddatestring="",
options={
'includereststrokes':False,
'workouttypes':[i[0] for i in mytypes.workouttypes],
'waterboattype':mytypes.waterboattype,
'rankingonly': False,
}):
enddatestring=timezone.now().strftime("%Y-%m-%d"),
startdatestring=(timezone.now()-datetime.timedelta(days=30)).strftime("%Y-%m-%d"),
options={
'includereststrokes':False,
'workouttypes':[i[0] for i in mytypes.workouttypes],
'waterboattype':mytypes.waterboattype,
'rankingonly': False,
}):
r = getrequestrower(request,userid=theuser)
theuser = r.user
@@ -3187,6 +3191,8 @@ def histo(request,theuser=0,
s = enddate
enddate = startdate
startdate = s
startdatestring = startdate.strftime('%Y-%m-%d')
enddatestring = enddate.strftime('%Y-%m-%d')
if modalityform.is_valid():
modality = modalityform.cleaned_data['modality']
waterboattype = modalityform.cleaned_data['waterboattype']