static charts moved to uploads.py
This commit is contained in:
@@ -215,21 +215,31 @@ urlpatterns = [
|
||||
url(r'^physics$',TemplateView.as_view(template_name='physics.html'),name='physics'),
|
||||
url(r'^partners$',TemplateView.as_view(template_name='partners.html'),name='partners'),
|
||||
url(r'^workout/(?P<id>\d+)/$',views.workout_view),
|
||||
url(r'^workout/(?P<id>\d+)/addtimeplot$',views.workout_add_chart_view,
|
||||
# keeping the old URLs for retrofit
|
||||
url(r'^workout/(?P<id>\d+)/addtimeplot$',
|
||||
views.workout_add_chart_view,
|
||||
{'plotnr':'1'}),
|
||||
url(r'^workout/(?P<id>\d+)/addpiechart$',views.workout_add_chart_view,
|
||||
{'plotnr':'3'}),
|
||||
url(r'^workout/(?P<id>\d+)/addpowerpiechart$',views.workout_add_chart_view,
|
||||
{'plotnr':'13'}),
|
||||
url(r'^workout/(?P<id>\d+)/adddistanceplot$',views.workout_add_chart_view,
|
||||
url(r'^workout/(?P<id>\d+)/adddistanceplot$',
|
||||
views.workout_add_chart_view,
|
||||
{'plotnr':'2'}),
|
||||
url(r'^workout/(?P<id>\d+)/adddistanceplot2$',views.workout_add_chart_view,
|
||||
url(r'^workout/(?P<id>\d+)/addpiechart$',
|
||||
views.workout_add_chart_view,
|
||||
{'plotnr':'3'}),
|
||||
url(r'^workout/(?P<id>\d+)/adddistanceplot2$',
|
||||
views.workout_add_chart_view,
|
||||
{'plotnr':'7'}),
|
||||
url(r'^workout/(?P<id>\d+)/addotwpowerplot$',views.workout_add_chart_view,
|
||||
{'plotnr':'9'}),
|
||||
url(r'^workout/(?P<id>\d+)/addtimeplot2$',views.workout_add_chart_view,
|
||||
url(r'^workout/(?P<id>\d+)/addtimeplot2$',
|
||||
views.workout_add_chart_view,
|
||||
{'plotnr':'8'}),
|
||||
url(r'^workout/(?P<id>\d+)/addstatic/(?P<plotnr>\d+)$',views.workout_add_chart_view),
|
||||
url(r'^workout/(?P<id>\d+)/addotwpowerplot$',
|
||||
views.workout_add_chart_view,
|
||||
{'plotnr':'9'}),
|
||||
url(r'^workout/(?P<id>\d+)/addpowerpiechart$',
|
||||
views.workout_add_chart_view,
|
||||
{'plotnr':'13'}),
|
||||
# addstatic is the new URL -> need to update in templates
|
||||
url(r'^workout/(?P<id>\d+)/addstatic/(?P<plotnr>\d+)$',
|
||||
views.workout_add_chart_view),
|
||||
url(r'^workout/(?P<id>\d+)/addstatic$',views.workout_add_chart_view),
|
||||
url(r'^workout/(?P<id>\d+)/delete$',views.workout_delete_view),
|
||||
url(r'^workout/(?P<id>\d+)/smoothenpace$',views.workout_smoothenpace_view),
|
||||
|
||||
161
rowers/views.py
161
rowers/views.py
@@ -6647,167 +6647,6 @@ def workout_add_chart_view(request,id,plotnr=1):
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# Create the chart image with wind corrected pace (OTW)
|
||||
@user_passes_test(ispromember,login_url="/",redirect_field_name=None)
|
||||
def workout_add_otw_powerplot_view(request,id):
|
||||
try:
|
||||
w = Workout.objects.get(id=id)
|
||||
except Workout.DoesNotExist:
|
||||
raise Http404("Workout doesn't exist")
|
||||
|
||||
if (checkworkoutuser(request.user,w)==False):
|
||||
raise PermissionDenied("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'
|
||||
u = w.user.user
|
||||
r = getrower(u)
|
||||
title = w.name
|
||||
res = uploads.make_plot(r,w,f1,w.csvfilename,'timeplot',title,plotnr=9,imagename=imagename)
|
||||
|
||||
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# Create the Heart rate zone pie chart
|
||||
@login_required()
|
||||
def workout_add_piechart_view(request,id):
|
||||
try:
|
||||
w = Workout.objects.get(id=id)
|
||||
except Workout.DoesNotExist:
|
||||
raise Http404("Workout doesn't exist")
|
||||
|
||||
if (checkworkoutuser(request.user,w)==False):
|
||||
raise PermissionDenied("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 = w.user.user
|
||||
r = getrower(u)
|
||||
title = w.name
|
||||
res = uploads.make_plot(r,w,f1,w.csvfilename,'pieplot',title,plotnr=3,imagename=imagename)
|
||||
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# Create the Power zone pie chart
|
||||
@login_required()
|
||||
def workout_add_power_piechart_view(request,id):
|
||||
try:
|
||||
w = Workout.objects.get(id=id)
|
||||
except Workout.DoesNotExist:
|
||||
raise Http404("Workout doesn't exist")
|
||||
|
||||
if (checkworkoutuser(request.user,w)==False):
|
||||
raise PermissionDenied("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 = w.user.user
|
||||
r = getrower(u)
|
||||
title = w.name
|
||||
res = uploads.make_plot(r,w,f1,w.csvfilename,'pieplot',title,plotnr=13,imagename=imagename)
|
||||
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# Create the time based summary chart
|
||||
@login_required()
|
||||
def workout_add_timeplot_view(request,id):
|
||||
try:
|
||||
w = Workout.objects.get(id=id)
|
||||
except Workout.DoesNotExist:
|
||||
raise Http404("Workout doesn't exist")
|
||||
|
||||
if (checkworkoutuser(request.user,w)==False):
|
||||
raise PermissionDenied("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 = w.user.user
|
||||
r = getrower(u)
|
||||
title = w.name
|
||||
res = uploads.make_plot(r,w,f1,w.csvfilename,'timeplot',title,plotnr=1,imagename=imagename)
|
||||
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# Create the distance based summary chart
|
||||
@login_required()
|
||||
def workout_add_distanceplot_view(request,id):
|
||||
try:
|
||||
w = Workout.objects.get(id=id)
|
||||
except Workout.DoesNotExist:
|
||||
raise Http404("Workout doesn't exist")
|
||||
|
||||
if (checkworkoutuser(request.user,w)==False):
|
||||
raise PermissionDenied("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 = w.user.user
|
||||
r = getrower(u)
|
||||
title = w.name
|
||||
res = uploads.make_plot(r,w,f1,w.csvfilename,'distanceplot',title,plotnr=2,imagename=imagename)
|
||||
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# Create the advanced parameters distance overview chart
|
||||
@user_passes_test(ispromember,login_url="/",redirect_field_name=None)
|
||||
def workout_add_distanceplot2_view(request,id):
|
||||
try:
|
||||
w = Workout.objects.get(id=id)
|
||||
except Workout.DoesNotExist:
|
||||
raise Http404("Workout doesn't exist")
|
||||
|
||||
if (checkworkoutuser(request.user,w)==False):
|
||||
raise PermissionDenied("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 = w.user.user
|
||||
r = getrower(u)
|
||||
title = w.name
|
||||
res = uploads.make_plot(r,w,f1,w.csvfilename,'distanceplot',title,plotnr=7,imagename=imagename)
|
||||
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
|
||||
# Create the advanced parameters time based overview chart
|
||||
@user_passes_test(ispromember,login_url="/",redirect_field_name=None)
|
||||
def workout_add_timeplot2_view(request,id):
|
||||
try:
|
||||
w = Workout.objects.get(id=id)
|
||||
except Workout.DoesNotExist:
|
||||
raise Http404("Workout doesn't exist")
|
||||
|
||||
if (checkworkoutuser(request.user,w)==False):
|
||||
raise PermissionDenied("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 = w.user.user
|
||||
r = getrower(u)
|
||||
title = w.name
|
||||
res = uploads.make_plot(r,w,f1,w.csvfilename,'distanceplot',title,plotnr=8,imagename=imagename)
|
||||
|
||||
url = "/rowers/workout/"+str(w.id)+"/edit"
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# The page where you select which Strava workout to import
|
||||
@login_required()
|
||||
|
||||
Reference in New Issue
Block a user