fine tuning the sending of email notifications
This commit is contained in:
@@ -82,6 +82,7 @@ from rowingdata import (
|
||||
from rowers.dataroutines import *
|
||||
|
||||
from rowers.tasks import (
|
||||
handle_sendemail_newftp,
|
||||
handle_sendemail_unrecognized, handle_setcp,
|
||||
handle_getagegrouprecords, handle_update_wps,
|
||||
handle_request_post, handle_calctrimp,
|
||||
@@ -735,8 +736,8 @@ def update_rolling_cp(r, types, mode='water'):
|
||||
r.p3 = p1[3]
|
||||
r.cpratio = res2[3]
|
||||
r.save()
|
||||
if pwr > r.ftp*(100.-r.otwslack)/100. and r.getemailnotifications and not r.emailbounced:
|
||||
_ = myqueue(queuehigh, handle_sendemail_newftp(r,pwr,'water'))
|
||||
if pwr-5 > r.ftp*(100.-r.otwslack)/100. and r.getemailnotifications and not r.emailbounced:
|
||||
_ = myqueue(queuehigh, handle_sendemail_newftp,r,pwr,'water')
|
||||
|
||||
else:
|
||||
r.ep0 = p1[0]
|
||||
@@ -745,8 +746,8 @@ def update_rolling_cp(r, types, mode='water'):
|
||||
r.ep3 = p1[3]
|
||||
r.ecpratio = res2[3]
|
||||
r.save()
|
||||
if pwr > r.ftp and r.getemailnotifications and not r.emailbounced:
|
||||
_ = myqueue(queuehigh, handle_sendemail_newftp(r,pwr,'water'))
|
||||
if pwr-5 > r.ftp and r.getemailnotifications and not r.emailbounced:
|
||||
_ = myqueue(queuehigh, handle_sendemail_newftp,r,pwr,'water')
|
||||
|
||||
|
||||
return True
|
||||
|
||||
@@ -1713,19 +1713,21 @@ def handle_sendemail_expired(useremail, userfirstname, userlastname, expireddate
|
||||
return 1
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_newftp(power,rower,mode, **kwargs):
|
||||
def handle_sendemail_newftp(rower,power,mode, **kwargs):
|
||||
subject = "You may want to update your FTP on rowsandall.com"
|
||||
from_email = 'Rowsandall <info@rowsandall.com>'
|
||||
|
||||
power = int(power)
|
||||
d = {
|
||||
'first_name': rower.user.first_name,
|
||||
'last_name': rower.user.last_name,
|
||||
'siteurl': siteurl,
|
||||
'ftp': r.ftp,
|
||||
'ftp': rower.ftp,
|
||||
'newftp': power,
|
||||
}
|
||||
|
||||
_ = send_template_email(from_email, [r.user.email],
|
||||
|
||||
_ = send_template_email(from_email, [rower.user.email],
|
||||
subject, 'newftpemail.html',
|
||||
d, **kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user