Private
Public Access
1
0

Rewrote interactiveplots to use timedelta everywhere for time and pace

This commit is contained in:
sanderroosendaal
2016-11-01 09:48:03 +01:00
parent 12c3ead542
commit 4dd42d43c7
5 changed files with 145 additions and 630 deletions

View File

@@ -2344,91 +2344,6 @@ def workout_comparison_view2(request,id1=0,id2=0,xparam='distance',
'promember':promember,
})
def workout_flexchart_view(request,id=0,xparam='distance',yparam1='pace',
yparam2='hr',
promember=0):
if request.method == 'POST':
workstrokesonly = request.POST['workstrokesonly']
else:
workstrokesonly = False
row = Workout.objects.get(id=id)
promember=0
mayedit=0
if not request.user.is_anonymous():
r = Rower.objects.get(user=request.user)
result = request.user.is_authenticated() and r.rowerplan=='pro'
if result:
promember=1
if request.user == row.user.user:
mayedit=1
# create interactive plot
res = interactive_flex_chart(id,xparam=xparam,yparam1=yparam1,
yparam2=yparam2,
promember=promember)
script = res[0]
div = res[1]
return render(request,
'flexchart.html',
{'interactiveplot':script,
'the_div':div,
'id':id,
'xparam':xparam,
'yparam1':yparam1,
'yparam2':yparam2,
'mayedit':mayedit,
})
def workout_flexchart2_view(request,id=0,xparam='distance',yparam1='pace',
yparam2='hr',plottype='line',
promember=0):
if request.method == 'POST':
workstrokesonly = request.POST['workstrokesonly']
if workstrokesonly == 'True':
workstrokesonly = True
else:
workstrokesonly = False
else:
workstrokesonly = False
row = Workout.objects.get(id=id)
promember=0
mayedit=0
if not request.user.is_anonymous():
r = Rower.objects.get(user=request.user)
result = request.user.is_authenticated() and r.rowerplan=='pro'
if result:
promember=1
if request.user == row.user.user:
mayedit=1
# create interactive plot
res = interactive_flex_chart(id,xparam=xparam,yparam1=yparam1,
yparam2=yparam2,
promember=promember,plottype=plottype,
workstrokesonly=workstrokesonly)
script = res[0]
div = res[1]
return render(request,
'flexchart2.html',
{'interactiveplot':script,
'the_div':div,
'id':id,
'xparam':xparam,
'yparam1':yparam1,
'yparam2':yparam2,
'plottype':plottype,
'mayedit':mayedit,
'promember':promember,
'workstrokesonly': not workstrokesonly,
})
def workout_flexchart3_view(request,id=0,xparam='distance',yparam1='pace',