Private
Public Access
1
0

additional metrics are available in flex chart

This commit is contained in:
Sander Roosendaal
2017-11-29 13:26:29 +01:00
parent 4e5b661923
commit a80df03d60
4 changed files with 97 additions and 70 deletions

View File

@@ -6455,7 +6455,10 @@ def instroke_view(request,id=0):
return HttpResponseRedirect(url)
rowdata = rrdata(csvfile=row.csvfilename)
instrokemetrics = rowdata.get_instroke_columns()
try:
instrokemetrics = rowdata.get_instroke_columns()
except AttributeError:
instrokemetrics = []
return render(request,
@@ -7491,7 +7494,12 @@ def workout_flexchart3_view(request,*args,**kwargs):
if yparam2 == name:
yparam2 = 'spm'
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_','/')
# create interactive plot
try:
script,div,js_resources,css_resources,workstrokesonly = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
@@ -7517,55 +7525,61 @@ def workout_flexchart3_view(request,*args,**kwargs):
if d['mode'] == 'erg':
axchoicespro.pop(name)
return render(request,
'flexchart3otw.html',
{'the_script':script,
'the_div':div,
'js_res': js_resources,
'css_res':css_resources,
'id':int(id),
'teams':get_my_teams(request.user),
'xparam':xparam,
'yparam1':yparam1,
'yparam2':yparam2,
'plottype':plottype,
'favoritechartnotes':favoritechartnotes,
'mayedit':mayedit,
'promember':promember,
'axchoicesbasic':axchoicesbasic,
'axchoicespro':axchoicespro,
'noylist':noylist,
'workstrokesonly': not workstrokesonly,
'favoritenr':favoritenr,
'maxfav':maxfav,
})
else:
for name,d in rowingmetrics:
if d['mode'] == 'water':
axchoicespro.pop(name)
return render(request,
'flexchart3otw.html',
{'the_script':script,
'the_div':div,
'js_res': js_resources,
'css_res':css_resources,
'teams':get_my_teams(request.user),
'id':int(id),
'xparam':xparam,
'yparam1':yparam1,
'yparam2':yparam2,
'plottype':plottype,
'axchoicesbasic':axchoicesbasic,
'axchoicespro':axchoicespro,
'favoritechartnotes':favoritechartnotes,
'noylist':noylist,
'mayedit':mayedit,
'promember':promember,
'workstrokesonly': not workstrokesonly,
'favoritenr':favoritenr,
'maxfav':maxfav,
})
rowdata = rdata(row.csvfilename)
additionalmetrics = rowdata.get_additional_metrics()
extrametrics = {m.replace('/','_slsh_'):m for m in additionalmetrics}
try:
extrametrics.pop('originalvelo')
except KeyError:
pass
try:
extrametrics.pop('cumdist')
except KeyError:
pass
try:
extrametrics.pop(' Cadence (strokes_slsh_min)')
except KeyError:
pass
try:
extrametrics.pop(' WorkPerStroke (joules)')
except KeyError:
pass
return render(request,
'flexchart3otw.html',
{'the_script':script,
'the_div':div,
'js_res': js_resources,
'css_res':css_resources,
'teams':get_my_teams(request.user),
'id':int(id),
'xparam':xparam,
'yparam1':yparam1,
'yparam2':yparam2,
'plottype':plottype,
'axchoicesbasic':axchoicesbasic,
'axchoicespro':axchoicespro,
'extrametrics':extrametrics,
'favoritechartnotes':favoritechartnotes,
'noylist':noylist,
'mayedit':mayedit,
'promember':promember,
'workstrokesonly': not workstrokesonly,
'favoritenr':favoritenr,
'maxfav':maxfav,
})
# The interactive plot with the colored Heart rate zones