power zones
This commit is contained in:
@@ -2830,6 +2830,50 @@ def workout_add_piechart_view(request,id):
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
@login_required()
|
||||
def workout_add_power_piechart_view(request,id):
|
||||
w = Workout.objects.get(id=id)
|
||||
if (checkworkoutuser(request.user,w)==False):
|
||||
return HttpResponse("You are not allowed add plots to this workout")
|
||||
else:
|
||||
f1 = w.csvfilename[6:-4]
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
imagename = f1+timestr+'.png'
|
||||
fullpathimagename = 'static/plots/'+imagename
|
||||
u = request.user
|
||||
r = Rower.objects.get(user=u)
|
||||
hrpwrdata = {
|
||||
'hrmax':r.max,
|
||||
'hrut2':r.ut2,
|
||||
'hrut1':r.ut1,
|
||||
'hrat':r.at,
|
||||
'hrtr':r.tr,
|
||||
'hran':r.an,
|
||||
'ftp':r.ftp,
|
||||
}
|
||||
|
||||
# make plot - asynchronous task
|
||||
plotnr = 13
|
||||
|
||||
if (w.workouttype=='water'):
|
||||
plotnr = plotnr+3
|
||||
|
||||
if settings.DEBUG:
|
||||
res = handle_makeplot.delay(f1,w.csvfilename,
|
||||
w.name,hrpwrdata,plotnr,imagename)
|
||||
else:
|
||||
res = queue.enqueue(handle_makeplot,f1,w.csvfilename,
|
||||
w.name,hrpwrdata,plotnr,imagename)
|
||||
|
||||
# i = GraphImage(workout=w,creationdatetime=datetime.datetime.now(),
|
||||
# filename=fullpathimagename)
|
||||
i = GraphImage(workout=w,creationdatetime=timezone.now(),
|
||||
filename=fullpathimagename)
|
||||
i.save()
|
||||
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
@login_required()
|
||||
def workout_add_timeplot_view(request,id):
|
||||
w = Workout.objects.get(id=id)
|
||||
|
||||
Reference in New Issue
Block a user