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

@@ -3468,8 +3468,11 @@ def thumbnail_flex_chart(rowdata,id=0,promember=0,
plot.yaxis.axis_label = 'Y'
yrange1 = Range1d(start=yaxminima[yparam1],end=yaxmaxima[yparam1])
try:
yrange1 = Range1d(start=yaxminima[yparam1],end=yaxmaxima[yparam1])
except KeyError:
yrange1 = Range1d(start=yparam1.min(), end=yparam1.max())
plot.y_range = yrange1
if (xparam != 'time') and (xparam != 'distance') and (xparam != 'cumdist'):

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