testing tasks and messages
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 209 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 113 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 66 KiB |
BIN
brochure WEB.pdf
@@ -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):
|
||||
|
||||
@@ -165,6 +165,7 @@ urlpatterns = [
|
||||
url(r'^workout/upload/$',views.workout_upload_view),
|
||||
url(r'^workout/upload/c/(?P<message>\w+.*)$',views.workout_upload_view),
|
||||
url(r'^workout/(?P<id>\d+)/histo$',views.workout_histo_view),
|
||||
url(r'^workout/(?P<id>\d+)/task$',views.workout_test_task_view),
|
||||
url(r'^workout/(?P<id>\d+)/forcecurve$',views.workout_forcecurve_view),
|
||||
url(r'^workout/(?P<id>\d+)/unsubscribe$',views.workout_unsubscribe_view),
|
||||
url(r'^workout/(?P<id>\d+)/export/c/(?P<message>\w+.*)/s/(?P<successmessage>\w+.*)$',views.workout_export_view),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import math
|
||||
import numpy as np
|
||||
|
||||
lbstoN = 4.44822
|
||||
|
||||
lbstoN = 4.44822
|
||||
|
||||
|
||||
def serialize_list(value,token=','):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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',
|
||||
]
|
||||
|
||||