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

File diff suppressed because it is too large Load Diff

View File

@@ -107,6 +107,7 @@ You will be taken to the secure PayPal payment site.
<ul>
<li>2016-11-01 Sliders to select subsets of data on some plots</li>
<li>2016-11-01 Emailing workouts to workouts@rowsandall.com </li>
<li>2016-11-01 Interval Editor </li>
<li>2016-09-30 Stroke Analysis Plot - with date range filtering</li>
<li>2016-09-29 Improved Flex plot, Power Histogram and Ranking Pieces - with date range filtering</li>
<li>2016-09-20 Added the Power histogram</li>

View File

@@ -229,22 +229,22 @@ class DataTest(TestCase):
res = iplots.interactive_chart(w.id,promember=1)
res = iplots.interactive_bar_chart(w.id)
res = iplots.interactive_bar_chart(w.id,promember=1)
res = iplots.interactive_flex_chart(w.id,promember=0,xparam='time',
res = iplots.interactive_flex_chart2(w.id,promember=0,xparam='time',
yparam1='pace',yparam2='hr')
res = iplots.interactive_flex_chart(w.id,promember=0,xparam='distance',
res = iplots.interactive_flex_chart2(w.id,promember=0,xparam='distance',
yparam1='pace',yparam2='hr')
res = iplots.interactive_flex_chart(w.id,promember=0,xparam='time',
res = iplots.interactive_flex_chart2(w.id,promember=0,xparam='time',
yparam1='pace',yparam2='spm')
res = iplots.interactive_flex_chart(w.id,promember=0,xparam='distance',
res = iplots.interactive_flex_chart2(w.id,promember=0,xparam='distance',
yparam1='pace',yparam2='spm')
res = iplots.interactive_flex_chart(w.id,promember=1,xparam='time',
res = iplots.interactive_flex_chart2(w.id,promember=1,xparam='time',
yparam1='pace',yparam2='hr')
res = iplots.interactive_flex_chart(w.id,promember=1,xparam='distance',
res = iplots.interactive_flex_chart2(w.id,promember=1,xparam='distance',
yparam1='pace',yparam2='hr')
res = iplots.interactive_flex_chart(w.id,promember=1,xparam='time',
res = iplots.interactive_flex_chart2(w.id,promember=1,xparam='time',
yparam1='pace',yparam2='spm')
res = iplots.interactive_flex_chart(w.id,promember=1,xparam='distance',
res = iplots.interactive_flex_chart2(w.id,promember=1,xparam='distance',
yparam1='pace',yparam2='spm')

View File

@@ -127,12 +127,8 @@ urlpatterns = [
url(r'^register/thankyou/$', TemplateView.as_view(template_name='registerthankyou.html'), name='registerthankyou'),
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<plottype>\w+)/$',views.workout_flexchart3_view),
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<plottype>\w+.*)$',views.workout_flexchart3_view),
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)$',views.workout_flexchart2_view),
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)$',views.workout_flexchart3_view),
url(r'^workout/(?P<id>\d+)/flexchart$',views.workout_flexchart3_view),
url(r'^workout/(?P<id>\d+)/flexchart2/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<plottype>\w+)/$',views.workout_flexchart2_view),
url(r'^workout/(?P<id>\d+)/flexchart2/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<plottype>\w+.*)$',views.workout_flexchart2_view),
url(r'^workout/(?P<id>\d+)/flexchart2/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)$',views.workout_flexchart3_view),
url(r'^workout/(?P<id>\d+)/flexchart2$',views.workout_flexchart2_view),
url(r'^workout/compare/(?P<id1>\d+)/(?P<id2>\d+)/(?P<xparam>\w+.*)/(?P<yparam>\w+.*)/(?P<plottype>\w+.*)$',views.workout_comparison_view2),
url(r'^workout/compare/(?P<id1>\d+)/(?P<id2>\d+)/(?P<xparam>\w+.*)/(?P<yparam>\w+.*)/$',views.workout_comparison_view2),
]

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',