refactoring and adding email confirmation / trimp calc to api v2
This commit is contained in:
@@ -4,7 +4,8 @@ from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from rowers.views.statements import *
|
||||
|
||||
from rowers.tasks import handle_calctrimp
|
||||
from rowers.mailprocessing import send_confirm
|
||||
|
||||
# Stroke data form to test API upload
|
||||
@login_required()
|
||||
@@ -310,6 +311,22 @@ def strokedatajson_v2(request,id):
|
||||
|
||||
datadf = dataprep.dataprep(rowdata,id=row.id,bands=True,barchart=True,otwpower=True,empower=True)
|
||||
|
||||
job = myqueue(queuehigh, handle_calctrimp, row.id, row.csvfilename, r.ftp,r.sex,r.hrftp, r.max, r.rest)
|
||||
|
||||
isbreakthrough, ishard = dataprep.checkbreakthrough(row, r)
|
||||
|
||||
if r.getemailnotifications and not r.emailbounced:
|
||||
link = settings.SITE_URL+reverse(
|
||||
r.defaultlandingpage,
|
||||
kwargs = {
|
||||
'id':encoder.encode_hex(row.id),
|
||||
}
|
||||
)
|
||||
email_sent = send_confirm(r.user, row.name, link, '')
|
||||
|
||||
result = uploads.do_sync(row,{},quick=True)
|
||||
|
||||
|
||||
with open('apilog.log','a') as logfile:
|
||||
logfile.write(str(timezone.now())+": ")
|
||||
logfile.write(request.user.username+" (strokedatajson_v2 POST completed successfully) \n")
|
||||
|
||||
Reference in New Issue
Block a user