Private
Public Access
1
0

v1 of workflow.html - need speed up chart generation

This commit is contained in:
Sander Roosendaal
2017-10-12 22:20:07 +02:00
parent 3028809d24
commit e806089ef7
4 changed files with 288 additions and 9 deletions

View File

@@ -5846,7 +5846,59 @@ def workout_comparison_view2(request,id1=0,id2=0,xparam='distance',
'promember':promember,
})
# Flex thumbnails
@login_required()
def workout_workflow_view(request,id):
try:
row = Workout.objects.get(id=id)
except Workout.DoesNotExist:
raise Http404("Workout doesn't exist")
r = getrower(request.user)
result = request.user.is_authenticated() and ispromember(request.user)
if result:
promember=1
if request.user == row.user.user:
mayedit=1
workouttype = 'ote'
if row.workouttype in ('water','coastal'):
workouttype = 'otw'
try:
favorites = FavoriteChart.objects.filter(user=r,
workouttype__in=[workouttype,'both']).order_by("id")
maxfav = len(favorites)-1
except:
favorites = None
maxfav = 0
charts = []
if favorites:
for f in favorites:
workstrokesonly = not f.reststrokes
script,div = thumbnail_flex_chart(id=id,promember=promember,
xparam=f.xparam,
yparam1=f.yparam1,
yparam2=f.yparam2,
plottype=f.plottype,
workstrokesonly=workstrokesonly)
charts.append({
'script':script,
'div':div,
'notes':f.notes})
return render(request,
'workflow.html',
{
'charts':charts,
'workout':row,
})
# The famous flex chart
def workout_flexchart3_view(request,*args,**kwargs):
@@ -5978,12 +6030,6 @@ def workout_flexchart3_view(request,*args,**kwargs):
css_resources = ""
# script = res[0]
# div = res[1]
# js_resources = res[2]
# css_resources = res[3]
axchoicesbasic = {ax[0]:ax[1] for ax in axes if ax[4]=='basic'}
axchoicespro = {ax[0]:ax[1] for ax in axes if ax[4]=='pro'}
noylist = ["time","distance"]