worked on getting back extrametrics (not fixed)
This commit is contained in:
@@ -957,6 +957,7 @@ class FlexAxesForm(forms.Form):
|
||||
choices=yaxchoices2,label='Right Axis',required=True)
|
||||
|
||||
def __init__(self,request,*args,**kwargs):
|
||||
extrametrics = kwargs.pop('extrametrics',[])
|
||||
super(FlexAxesForm, self).__init__(*args, **kwargs)
|
||||
|
||||
rower = Rower.objects.get(user=request.user)
|
||||
|
||||
@@ -8792,13 +8792,18 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
||||
workstrokesonly = not includereststrokes
|
||||
|
||||
flexaxesform = FlexAxesForm(request,request.POST)
|
||||
|
||||
print request.POST
|
||||
|
||||
if flexaxesform.is_valid():
|
||||
print 'form valid'
|
||||
cd = flexaxesform.cleaned_data
|
||||
xparam = cd['xaxis']
|
||||
yparam1 = cd['yaxis1']
|
||||
yparam2 = cd['yaxis2']
|
||||
else:
|
||||
print flexaxesform.errors
|
||||
|
||||
print xparam,yparam1,yparam2
|
||||
|
||||
if not promember:
|
||||
for name,d in rowingmetrics:
|
||||
@@ -8814,9 +8819,9 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
||||
messages.info(request,'To use '+d['verbose_name']+', you have to be Pro member')
|
||||
|
||||
# bring back slashes
|
||||
yparam1 = yparam1.replace('_slsh_','/')
|
||||
yparam2 = yparam2.replace('_slsh_','/')
|
||||
xparam = xparam.replace('_slsh_','/')
|
||||
# yparam1 = yparam1.replace('_slsh_','/')
|
||||
# yparam2 = yparam2.replace('_slsh_','/')
|
||||
# xparam = xparam.replace('_slsh_','/')
|
||||
|
||||
# create interactive plot
|
||||
try:
|
||||
@@ -8878,25 +8883,27 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
||||
additionalmetrics = []
|
||||
|
||||
|
||||
extrametrics = {m.replace('/','_slsh_'):m for m in additionalmetrics}
|
||||
# extrametrics = {m.replace('/','_slsh_'):m for m in additionalmetrics}
|
||||
extrametrics = additionalmetrics
|
||||
|
||||
xparam = xparam.replace('/','_slsh_')
|
||||
yparam1 = yparam1.replace('/','_slsh_')
|
||||
yparam2 = yparam2.replace('/','_slsh_')
|
||||
# xparam = xparam.replace('/','_slsh_')
|
||||
# yparam1 = yparam1.replace('/','_slsh_')
|
||||
# yparam2 = yparam2.replace('/','_slsh_')
|
||||
|
||||
|
||||
for metric in nometrics:
|
||||
try:
|
||||
extrametrics.pop(metric)
|
||||
except KeyError:
|
||||
pass
|
||||
# for metric in nometrics:
|
||||
# try:
|
||||
# extrametrics.pop(metric)
|
||||
# except KeyError:
|
||||
# pass
|
||||
|
||||
initial = {
|
||||
'xaxis':xparam,
|
||||
'yaxis1':yparam1,
|
||||
'yaxis2':yparam2
|
||||
'yaxis2':yparam2,
|
||||
}
|
||||
flexaxesform = FlexAxesForm(request,initial=initial)
|
||||
flexaxesform = FlexAxesForm(request,initial=initial,
|
||||
extrametrics=extrametrics)
|
||||
|
||||
initial = {
|
||||
'includereststrokes': not workstrokesonly,
|
||||
|
||||
Reference in New Issue
Block a user