Private
Public Access
1
0

a wrapper around the task queue

This commit is contained in:
Sander Roosendaal
2017-10-31 11:12:00 +01:00
parent 092d24d9b2
commit 8c31f5b778
3 changed files with 85 additions and 133 deletions

View File

@@ -30,7 +30,7 @@ from rowers.dataprepnodjango import (
)
from django.core.mail import send_mail, EmailMessage
from django.db.utils import OperationalError
import datautils
import utils
@@ -376,9 +376,13 @@ def handle_otwsetpower(f1, boattype, weightvalue,
res, btvalues, res2 = utils.isbreakthrough(
delta, cpvalues, ps[0], ps[1], ps[2], ps[3], ratio)
if res:
handle_sendemail_breakthrough(workoutid, email,
first_name,
last_name, btvalues=btvalues.to_json())
try:
handle_sendemail_breakthrough(
workoutid, email,
first_name,
last_name, btvalues=btvalues.to_json())
except OperationalError:
pass
# send email
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
@@ -394,9 +398,12 @@ def handle_otwsetpower(f1, boattype, weightvalue,
message += "Please report any bugs/inconsistencies/unexpected results at rowsandall.slack.com or by reply to this email.\n\n"
message += "Best Regards, The Rowsandall Physics Department."
send_mail(subject, message,
'Rowsandall Physics Department <info@rowsandall.com>',
[fullemail])
try:
send_mail(subject, message,
'Rowsandall Physics Department <info@rowsandall.com>',
[fullemail])
except OperationalError:
return 0
return 1