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