strava style chart v 1
This commit is contained in:
@@ -76,6 +76,7 @@ from rowers.forms import (
|
||||
disqualifiers,SearchForm,BillingForm,PlanSelectForm,
|
||||
VideoAnalysisCreateForm,WorkoutSingleSelectForm,
|
||||
VideoAnalysisMetricsForm,SurveyForm,HistorySelectForm,
|
||||
StravaChartForm,
|
||||
)
|
||||
|
||||
from django.urls import reverse, reverse_lazy
|
||||
|
||||
@@ -3938,7 +3938,90 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
||||
'maxfav':maxfav,
|
||||
})
|
||||
|
||||
@login_required()
|
||||
@permission_required('workout.view_workout',fn=get_workout_by_opaqueid,raise_exception=True)
|
||||
def workout_flexchart_stacked_view(request,*args,**kwargs):
|
||||
try:
|
||||
id = kwargs['id']
|
||||
except KeyError:
|
||||
raise Http404("Invalid workout number")
|
||||
|
||||
workout = get_workout(id)
|
||||
r = getrequestrower(request)
|
||||
|
||||
xparam = 'time'
|
||||
yparam1 = 'pace'
|
||||
yparam2 = 'power'
|
||||
yparam3 = 'hr'
|
||||
yparam4 = 'spm'
|
||||
|
||||
if request.method == 'POST':
|
||||
flexaxesform = StravaChartForm(request,request.POST)
|
||||
if flexaxesform.is_valid():
|
||||
cd = flexaxesform.cleaned_data
|
||||
xparam = cd['xaxis']
|
||||
yparam1 = cd['yaxis1']
|
||||
yparam2 = cd['yaxis2']
|
||||
yparam3 = cd['yaxis3']
|
||||
yparam4 = cd['yaxis4']
|
||||
|
||||
(
|
||||
script, div, js_resources, css_resources
|
||||
) = interactive_flexchart_stacked(
|
||||
encoder.decode_hex(id),r,xparam=xparam,
|
||||
yparam1=yparam1,
|
||||
yparam2=yparam2,
|
||||
yparam3=yparam3,
|
||||
yparam4=yparam4,
|
||||
mode=workout.workouttype,
|
||||
)
|
||||
|
||||
initial = {
|
||||
'xaxis':xparam,
|
||||
'yaxis1':yparam1,
|
||||
'yaxis2':yparam2,
|
||||
'yaxis3':yparam3,
|
||||
'yaxis4':yparam4,
|
||||
}
|
||||
flexaxesform = StravaChartForm(request,initial=initial,
|
||||
)
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':'/rowers/list-workouts/',
|
||||
'name':'Workouts'
|
||||
},
|
||||
{
|
||||
'url':get_workout_default_page(request,id),
|
||||
'name': workout.name
|
||||
},
|
||||
{
|
||||
'url':reverse('workout_flexchart_stacked_view',kwargs=kwargs),
|
||||
'name': 'Stacked Flex Chart'
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
return render(request,
|
||||
'flexchartstacked.html',
|
||||
{
|
||||
'the_script':script,
|
||||
'the_div':div,
|
||||
'breadcrumbs':breadcrumbs,
|
||||
'rower':r,
|
||||
'active':'nav-workouts',
|
||||
'workout':workout,
|
||||
'chartform':flexaxesform,
|
||||
'js_res':js_resources,
|
||||
'css_res':css_resources,
|
||||
'id':id,
|
||||
'xparam':xparam,
|
||||
'yparam1':yparam1,
|
||||
'yparam2':yparam2,
|
||||
'yparam3':yparam3,
|
||||
'yparam4':yparam4,
|
||||
}
|
||||
)
|
||||
|
||||
# The interactive plot with wind corrected pace for OTW outings
|
||||
def workout_otwpowerplot_view(request,id=0,message="",successmessage=""):
|
||||
|
||||
Reference in New Issue
Block a user