Private
Public Access
1
0

restricted allowable static images to 6

This commit is contained in:
Sander Roosendaal
2018-01-23 12:09:41 +01:00
parent 585b48cdf6
commit 983b3be86c
3 changed files with 38 additions and 25 deletions

View File

@@ -7112,13 +7112,17 @@ def instroke_chart(request,id=0,metric=''):
width = 1200
height = 600
i = GraphImage(workout=w,
creationdatetime=timezone.now(),
filename=fullpathimagename,
width=width,height=height)
i.save()
print i.id,'aap'
imgs = GraphImage.objects.filter(workout=w)
if len(imgs) < 7:
i = GraphImage(workout=w,
creationdatetime=timezone.now(),
filename=fullpathimagename,
width=width,height=height)
i.save()
else:
messages.error(request,'You have reached the maximum number of static images for this workout. Delete an image first')
r = getrower(request.user)
url = reverse(r.defaultlandingpage,
@@ -8855,10 +8859,13 @@ def workout_add_chart_view(request,id,plotnr=1):
r,w,f1,w.csvfilename,'timeplot',title,plotnr=plotnr,
imagename=imagename
)
try:
request.session['async_tasks'] += [(jobid,'make_plot')]
except KeyError:
request.session['async_tasks'] = [(jobid,'make_plot')]
if res == 0:
messages.error(request,jobid)
else:
try:
request.session['async_tasks'] += [(jobid,'make_plot')]
except KeyError:
request.session['async_tasks'] = [(jobid,'make_plot')]
try:
url = request.session['referer']
@@ -9739,10 +9746,13 @@ def workout_upload_view(request,
r = getrower(request.user)
if (make_plot):
res,jobid = uploads.make_plot(r,w,f1,f2,plottype,t)
try:
request.session['async_tasks'] += [(jobid,'make_plot')]
except KeyError:
request.session['async_tasks'] = [(jobid,'make_plot')]
if res == 0:
messages.error(request,jobid)
else:
try:
request.session['async_tasks'] += [(jobid,'make_plot')]
except KeyError:
request.session['async_tasks'] = [(jobid,'make_plot')]
# upload to C2
if (upload_to_c2):
@@ -9988,7 +9998,8 @@ def team_workout_upload_view(request,message="",
r = getrower(request.user)
if (make_plot):
id = uploads.make_plot(r,w,f1,f2,plottype,t)
id,jobid = uploads.make_plot(r,w,f1,f2,plottype,t)