adding some info to email
This commit is contained in:
@@ -43,6 +43,26 @@ class Command(BaseCommand):
|
|||||||
for alert in todaysalerts:
|
for alert in todaysalerts:
|
||||||
stats = alerts.alert_get_stats(alert)
|
stats = alerts.alert_get_stats(alert)
|
||||||
|
|
||||||
|
# explanatorytexts
|
||||||
|
if alert.measured.condition == 'between':
|
||||||
|
description = 'This alert measures strokes where {metric} is between {value1} and {value2}.'.format(
|
||||||
|
metric = alert.measured.metric,
|
||||||
|
value1 = alert.measured.value1,
|
||||||
|
value2 = alert.measured.value2,
|
||||||
|
)
|
||||||
|
elif alert.measured.condition == '<':
|
||||||
|
description = 'This alert measures strokes where {metric} is smaller than {value1}.'.format(
|
||||||
|
metric = alert.measured.metric,
|
||||||
|
value1 = alert.measured.value1,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
description = 'This alert measures strokes where {metric} is larger than {value1}.'.format(
|
||||||
|
metric = alert.measured.metric,
|
||||||
|
value1 = alert.measured.value1,
|
||||||
|
)
|
||||||
|
|
||||||
|
othertexts = [description]
|
||||||
|
|
||||||
# send email
|
# send email
|
||||||
job = myqueue(queue,handle_send_email_alert,
|
job = myqueue(queue,handle_send_email_alert,
|
||||||
alert.manager.email,
|
alert.manager.email,
|
||||||
@@ -50,7 +70,8 @@ class Command(BaseCommand):
|
|||||||
alert.manager.last_name,
|
alert.manager.last_name,
|
||||||
alert.rower.user.first_name,
|
alert.rower.user.first_name,
|
||||||
alert.name,
|
alert.name,
|
||||||
stats,debug=True)
|
stats,debug=True,
|
||||||
|
othertexts=othertexts)
|
||||||
|
|
||||||
# advance next_run
|
# advance next_run
|
||||||
if not testing:
|
if not testing:
|
||||||
|
|||||||
@@ -765,6 +765,11 @@ def handle_send_email_alert(
|
|||||||
else:
|
else:
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
|
if 'othertexts' in kwargs:
|
||||||
|
othertexts = kwargs['othertexts']
|
||||||
|
else:
|
||||||
|
othertexts = None
|
||||||
|
|
||||||
subject = "Your rowing performance on rowsandall.com ({startdate} to {enddate})".format(
|
subject = "Your rowing performance on rowsandall.com ({startdate} to {enddate})".format(
|
||||||
startdate = stats['startdate'],
|
startdate = stats['startdate'],
|
||||||
enddate = stats['enddate'],
|
enddate = stats['enddate'],
|
||||||
@@ -779,6 +784,7 @@ def handle_send_email_alert(
|
|||||||
'siteurl':siteurl,
|
'siteurl':siteurl,
|
||||||
'rowerfirstname':rowerfirstname,
|
'rowerfirstname':rowerfirstname,
|
||||||
'alertname':alertname,
|
'alertname':alertname,
|
||||||
|
'othertexts':othertexts,
|
||||||
}
|
}
|
||||||
|
|
||||||
res = send_template_email(from_email,[useremail],subject,
|
res = send_template_email(from_email,[useremail],subject,
|
||||||
|
|||||||
@@ -7,6 +7,12 @@
|
|||||||
Here is the report for your alert <strong>{{ alertname }}</strong> on <a href="{{ siteurl }}">rowsandall.com</a>. This is a report for your athlete {{ rowerfirstname }}.
|
Here is the report for your alert <strong>{{ alertname }}</strong> on <a href="{{ siteurl }}">rowsandall.com</a>. This is a report for your athlete {{ rowerfirstname }}.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
{% for text in othertexts %}
|
||||||
|
<p>
|
||||||
|
{{ text|safe }}
|
||||||
|
</p>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% for key, value in report.items() %}
|
{% for key, value in report.items() %}
|
||||||
<p>
|
<p>
|
||||||
{{ key }}: {{ value }}
|
{{ key }}: {{ value }}
|
||||||
|
|||||||
Reference in New Issue
Block a user