Private
Public Access
1
0

forbidden saving ad hoc metrics as favorite chart

This commit is contained in:
Sander Roosendaal
2018-04-13 08:16:46 +02:00
parent ea526d1ae0
commit 06ecf74cb5
2 changed files with 16 additions and 4 deletions

View File

@@ -8413,11 +8413,20 @@ def workout_flexchart3_view(request,*args,**kwargs):
workstrokesonly = request.POST['workstrokesonlysave']
reststrokes = not workstrokesonly
r = getrower(request.user)
f = FavoriteChart(user=r,xparam=xparam,
try:
r = metrics.yaxmaxima[xparam]
if yparam1 is not None:
r = metrics.yaxmaxima[yparam1]
if yparam2 is not None:
r = metrics.yaxmaxima[yparam2]
f = FavoriteChart(user=r,xparam=xparam,
yparam1=yparam1,yparam2=yparam2,
plottype=plottype,workouttype=workouttype,
reststrokes=reststrokes)
f.save()
f.save()
except KeyError:
messages.error(request,'We cannot save the ad hoc metrics in a favorite chart')
if request.method == 'POST' and 'workstrokesonly' in request.POST:
workstrokesonly = request.POST['workstrokesonly']