disqualification now with review and form
This commit is contained in:
@@ -41,6 +41,22 @@ from django.utils.html import strip_tags
|
||||
|
||||
from utils import deserialize_list,ewmovingaverage,wavg
|
||||
|
||||
from HTMLParser import HTMLParser
|
||||
class MLStripper(HTMLParser):
|
||||
def __init__(self):
|
||||
self.reset()
|
||||
self.fed = []
|
||||
def handle_data(self, d):
|
||||
self.fed.append(d)
|
||||
def get_data(self):
|
||||
return ''.join(self.fed)
|
||||
|
||||
def strip_tags(html):
|
||||
s = MLStripper()
|
||||
s.feed(html)
|
||||
return s.get_data()
|
||||
|
||||
|
||||
from rowers.dataprepnodjango import (
|
||||
update_strokedata, new_workout_from_file,
|
||||
getsmallrowdata_db, updatecpdata_sql,
|
||||
@@ -721,6 +737,35 @@ def handle_updatedps(useremail, workoutids, debug=False,**kwargs):
|
||||
|
||||
# send email when a breakthrough workout is uploaded
|
||||
|
||||
@app.task
|
||||
def handle_send_disqualification_email(
|
||||
useremail,username,reason,message, racename, **kwargs):
|
||||
|
||||
if 'debug' in kwargs:
|
||||
debug = kwargs['debug']
|
||||
else:
|
||||
debug = True
|
||||
|
||||
subject = "Your result for {n} has been disqualified on rowsandall.com".format(
|
||||
n = racename
|
||||
)
|
||||
|
||||
from_email = 'Rowsandall <support@rowsandall.com>'
|
||||
|
||||
d = {
|
||||
'username':username,
|
||||
'reason':reason,
|
||||
'message': strip_tags(message),
|
||||
'racename':racename,
|
||||
}
|
||||
|
||||
res = send_template_email(from_email,[useremail],
|
||||
subject,
|
||||
'disqualificationemail.html',
|
||||
d,**kwargs)
|
||||
|
||||
return 1
|
||||
|
||||
@app.task
|
||||
def handle_sendemail_expired(useremail,userfirstname,userlastname,expireddate,
|
||||
**kwargs):
|
||||
|
||||
Reference in New Issue
Block a user