diff --git a/20170214-101932-sled_2017-02-13T19-39-36ZGMT+1.strokes20170215-130841.png b/20170214-101932-sled_2017-02-13T19-39-36ZGMT+1.strokes20170215-130841.png deleted file mode 100644 index a5b9828b..00000000 Binary files a/20170214-101932-sled_2017-02-13T19-39-36ZGMT+1.strokes20170215-130841.png and /dev/null differ diff --git a/20170215-154523-sled_2017-01-12T19-55-38ZGMT+1.strokes.png b/20170215-154523-sled_2017-01-12T19-55-38ZGMT+1.strokes.png deleted file mode 100644 index e3ec6dd8..00000000 Binary files a/20170215-154523-sled_2017-01-12T19-55-38ZGMT+1.strokes.png and /dev/null differ diff --git a/20170215-160054-sled_2017-02-07T20-02-52ZGMT+1.strokes.png b/20170215-160054-sled_2017-02-07T20-02-52ZGMT+1.strokes.png deleted file mode 100644 index 3d33a855..00000000 Binary files a/20170215-160054-sled_2017-02-07T20-02-52ZGMT+1.strokes.png and /dev/null differ diff --git a/20170216-150049-SpeedCoach2v2.12o20170216-150134.png b/20170216-150049-SpeedCoach2v2.12o20170216-150134.png deleted file mode 100644 index e849066b..00000000 Binary files a/20170216-150049-SpeedCoach2v2.12o20170216-150134.png and /dev/null differ diff --git a/20170219-094015-RP3_2016-08-27_13-55-55 (3)o20170219-094021.png b/20170219-094015-RP3_2016-08-27_13-55-55 (3)o20170219-094021.png deleted file mode 100644 index 620e226d..00000000 Binary files a/20170219-094015-RP3_2016-08-27_13-55-55 (3)o20170219-094021.png and /dev/null differ diff --git a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-071404.png b/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-071404.png deleted file mode 100644 index a6279dfa..00000000 Binary files a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-071404.png and /dev/null differ diff --git a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-132651.png b/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-132651.png deleted file mode 100644 index a3131bff..00000000 Binary files a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-132651.png and /dev/null differ diff --git a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-161108.png b/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-161108.png deleted file mode 100644 index 883bd655..00000000 Binary files a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-161108.png and /dev/null differ diff --git a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-162713.png b/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-162713.png deleted file mode 100644 index 9a388930..00000000 Binary files a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-162713.png and /dev/null differ diff --git a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-162718.png b/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-162718.png deleted file mode 100644 index e330fcb7..00000000 Binary files a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170228-162718.png and /dev/null differ diff --git a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170301-143433.png b/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170301-143433.png deleted file mode 100644 index e4a60516..00000000 Binary files a/20170228-070631-Sanders SpeedCoach 20170227 0402pmo20170301-143433.png and /dev/null differ diff --git a/20170303-081353-sled_2016-12-17T12-56-28ZEST.strokes.png b/20170303-081353-sled_2016-12-17T12-56-28ZEST.strokes.png deleted file mode 100644 index cf177b77..00000000 Binary files a/20170303-081353-sled_2016-12-17T12-56-28ZEST.strokes.png and /dev/null differ diff --git a/20170303-081353-sled_2016-12-17T12-56-28ZEST.strokes20170303-081416.png b/20170303-081353-sled_2016-12-17T12-56-28ZEST.strokes20170303-081416.png deleted file mode 100644 index e8f79347..00000000 Binary files a/20170303-081353-sled_2016-12-17T12-56-28ZEST.strokes20170303-081416.png and /dev/null differ diff --git a/20170303-123422-Sanders SpeedCoach 20170301 0421pm.png b/20170303-123422-Sanders SpeedCoach 20170301 0421pm.png deleted file mode 100644 index 3d23c412..00000000 Binary files a/20170303-123422-Sanders SpeedCoach 20170301 0421pm.png and /dev/null differ diff --git a/20170309-221254-sled_2017-03-09T20-06-31ZGMT+1.strokes20170309-221304.png b/20170309-221254-sled_2017-03-09T20-06-31ZGMT+1.strokes20170309-221304.png deleted file mode 100644 index 28396c90..00000000 Binary files a/20170309-221254-sled_2017-03-09T20-06-31ZGMT+1.strokes20170309-221304.png and /dev/null differ diff --git a/20170328-1442360o20170328-144425.png b/20170328-1442360o20170328-144425.png deleted file mode 100644 index 7095d97d..00000000 Binary files a/20170328-1442360o20170328-144425.png and /dev/null differ diff --git a/20170330-2211010o20170407-100356.png b/20170330-2211010o20170407-100356.png deleted file mode 100644 index 18f8ea06..00000000 Binary files a/20170330-2211010o20170407-100356.png and /dev/null differ diff --git a/20170330-2211010o20170407-100400.png b/20170330-2211010o20170407-100400.png deleted file mode 100644 index d9a3f4e9..00000000 Binary files a/20170330-2211010o20170407-100400.png and /dev/null differ diff --git a/20170401-201517-Imported (1)o20170404-205215.png b/20170401-201517-Imported (1)o20170404-205215.png deleted file mode 100644 index 32bb5ebe..00000000 Binary files a/20170401-201517-Imported (1)o20170404-205215.png and /dev/null differ diff --git a/20170413-090921-Sanders SpeedCoach 20170410 0555pm.png b/20170413-090921-Sanders SpeedCoach 20170410 0555pm.png deleted file mode 100644 index 4b9967ac..00000000 Binary files a/20170413-090921-Sanders SpeedCoach 20170410 0555pm.png and /dev/null differ diff --git a/20170413-105500-Sanders SpeedCoach 20170410 0555pm.png b/20170413-105500-Sanders SpeedCoach 20170410 0555pm.png deleted file mode 100644 index 26d39622..00000000 Binary files a/20170413-105500-Sanders SpeedCoach 20170410 0555pm.png and /dev/null differ diff --git a/20170413-113844-Sanders SpeedCoach 20170401 0914am.png b/20170413-113844-Sanders SpeedCoach 20170401 0914am.png deleted file mode 100644 index 88734ccc..00000000 Binary files a/20170413-113844-Sanders SpeedCoach 20170401 0914am.png and /dev/null differ diff --git a/20170504-123826-Sanders SpeedCoach 20170503 0642pmo20170504-140047.png b/20170504-123826-Sanders SpeedCoach 20170503 0642pmo20170504-140047.png deleted file mode 100644 index fb6b68cd..00000000 Binary files a/20170504-123826-Sanders SpeedCoach 20170503 0642pmo20170504-140047.png and /dev/null differ diff --git a/20170504-123826-Sanders SpeedCoach 20170503 0642pmo20170504-145537.png b/20170504-123826-Sanders SpeedCoach 20170503 0642pmo20170504-145537.png deleted file mode 100644 index 723bcfd8..00000000 Binary files a/20170504-123826-Sanders SpeedCoach 20170503 0642pmo20170504-145537.png and /dev/null differ diff --git a/Fusion_20170308-17041420170308-170456.png b/Fusion_20170308-17041420170308-170456.png deleted file mode 100644 index accd412d..00000000 Binary files a/Fusion_20170308-17041420170308-170456.png and /dev/null differ diff --git a/Fusion_20170309-23351620170309-233634.png b/Fusion_20170309-23351620170309-233634.png deleted file mode 100644 index 9da35d41..00000000 Binary files a/Fusion_20170309-23351620170309-233634.png and /dev/null differ diff --git a/Fusion_20170310-21135320170310-211846.png b/Fusion_20170310-21135320170310-211846.png deleted file mode 100644 index 1a0b9b65..00000000 Binary files a/Fusion_20170310-21135320170310-211846.png and /dev/null differ diff --git a/Fusion_20170310-21135320170310-211851.png b/Fusion_20170310-21135320170310-211851.png deleted file mode 100644 index 76a72325..00000000 Binary files a/Fusion_20170310-21135320170310-211851.png and /dev/null differ diff --git a/Fusion_20170310-21135320170310-211904.png b/Fusion_20170310-21135320170310-211904.png deleted file mode 100644 index 4d930ee2..00000000 Binary files a/Fusion_20170310-21135320170310-211904.png and /dev/null differ diff --git a/Fusion_20170406-22214120170406-222204.png b/Fusion_20170406-22214120170406-222204.png deleted file mode 100644 index 9d38f71a..00000000 Binary files a/Fusion_20170406-22214120170406-222204.png and /dev/null differ diff --git a/Import_1401471420170309-225813.png b/Import_1401471420170309-225813.png deleted file mode 100644 index 350029ff..00000000 Binary files a/Import_1401471420170309-225813.png and /dev/null differ diff --git a/Import_2882167420170213-223113.png b/Import_2882167420170213-223113.png deleted file mode 100644 index ea5e767a..00000000 Binary files a/Import_2882167420170213-223113.png and /dev/null differ diff --git a/Import_89184875320170309-125803.png b/Import_89184875320170309-125803.png deleted file mode 100644 index 6f050875..00000000 Binary files a/Import_89184875320170309-125803.png and /dev/null differ diff --git a/brochure WEB.pdf b/brochure WEB.pdf deleted file mode 100644 index b4f3c69e..00000000 Binary files a/brochure WEB.pdf and /dev/null differ diff --git a/rowers/tpstuff.py b/rowers/tpstuff.py index d9c25fa0..520d302f 100644 --- a/rowers/tpstuff.py +++ b/rowers/tpstuff.py @@ -27,6 +27,7 @@ from django.conf import settings from django.contrib.auth import authenticate, login, logout from django.contrib.auth.models import User from django.contrib.auth.decorators import login_required +from django.contrib import messages # Project # from .models import Profile @@ -43,6 +44,22 @@ from rowsandall_app.settings import ( tpapilocation = "https://api.trainingpeaks.com" +from celery import Celery,app +import time +from async_messages import message_user + +@app.task +def addcomment(userid,id): + time.sleep(5) + w = Workout.objects.get(id=id) + w.notes += '\n the task has run' + w.save() + u = User.objects.get(id=userid) + message_user(u,' The task has run') + return 1 + + + # Custom error class - to raise a NoTokenError class TPNoTokenError(Exception): def __init__(self,value): diff --git a/rowers/urls.py b/rowers/urls.py index 953df0f0..ac183622 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -165,6 +165,7 @@ urlpatterns = [ url(r'^workout/upload/$',views.workout_upload_view), url(r'^workout/upload/c/(?P\w+.*)$',views.workout_upload_view), url(r'^workout/(?P\d+)/histo$',views.workout_histo_view), + url(r'^workout/(?P\d+)/task$',views.workout_test_task_view), url(r'^workout/(?P\d+)/forcecurve$',views.workout_forcecurve_view), url(r'^workout/(?P\d+)/unsubscribe$',views.workout_unsubscribe_view), url(r'^workout/(?P\d+)/export/c/(?P\w+.*)/s/(?P\w+.*)$',views.workout_export_view), diff --git a/rowers/utils.py b/rowers/utils.py index 9d345c46..b700cba3 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -1,8 +1,8 @@ import math import numpy as np -lbstoN = 4.44822 +lbstoN = 4.44822 def serialize_list(value,token=','): diff --git a/rowers/views.py b/rowers/views.py index 1b238a18..2498bd1c 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -84,7 +84,7 @@ from rowers.rows import handle_uploaded_file from rowers.tasks import handle_makeplot,handle_otwsetpower,handle_sendemailtcx,handle_sendemailcsv from rowers.tasks import ( handle_sendemail_unrecognized,handle_sendemailnewcomment, - handle_sendemailnewresponse, + handle_sendemailnewresponse ) from scipy.signal import savgol_filter @@ -2182,6 +2182,22 @@ def workout_forcecurve_view(request,id=0,workstrokesonly=False): 'teams':get_my_teams(request.user), }) +from rowers.tpstuff import addcomment +# Test asynchronous tasking and messaging +@login_required() +def workout_test_task_view(request,id=0): + row = Workout.objects.get(id=id) + if settings.DEBUG: + res = addcomment.delay(request.user.id,row.id) + else: + res = queuelow.enqueue(addcomment,request.user.id,row.id) + + url = reverse(workout_edit_view, + kwargs = { + 'id':str(id), + }) + return HttpResponseRedirect(url) + # Show Stroke power histogram for a workout @login_required() def workout_histo_view(request,id=0): diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index 48486dcd..3d9caec5 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -83,6 +83,7 @@ MIDDLEWARE_CLASSES = [ 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'oauth2_provider.middleware.OAuth2TokenMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', + 'async_messages.middleware.AsyncMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', # 'debug_toolbar.middleware.DebugToolbarMiddleware', ]