adding some info to email
This commit is contained in:
@@ -42,6 +42,26 @@ class Command(BaseCommand):
|
||||
|
||||
for alert in todaysalerts:
|
||||
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
|
||||
job = myqueue(queue,handle_send_email_alert,
|
||||
@@ -50,7 +70,8 @@ class Command(BaseCommand):
|
||||
alert.manager.last_name,
|
||||
alert.rower.user.first_name,
|
||||
alert.name,
|
||||
stats,debug=True)
|
||||
stats,debug=True,
|
||||
othertexts=othertexts)
|
||||
|
||||
# advance next_run
|
||||
if not testing:
|
||||
|
||||
@@ -765,6 +765,11 @@ def handle_send_email_alert(
|
||||
else:
|
||||
debug = False
|
||||
|
||||
if 'othertexts' in kwargs:
|
||||
othertexts = kwargs['othertexts']
|
||||
else:
|
||||
othertexts = None
|
||||
|
||||
subject = "Your rowing performance on rowsandall.com ({startdate} to {enddate})".format(
|
||||
startdate = stats['startdate'],
|
||||
enddate = stats['enddate'],
|
||||
@@ -779,6 +784,7 @@ def handle_send_email_alert(
|
||||
'siteurl':siteurl,
|
||||
'rowerfirstname':rowerfirstname,
|
||||
'alertname':alertname,
|
||||
'othertexts':othertexts,
|
||||
}
|
||||
|
||||
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 }}.
|
||||
</p>
|
||||
|
||||
{% for text in othertexts %}
|
||||
<p>
|
||||
{{ text|safe }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
|
||||
{% for key, value in report.items() %}
|
||||
<p>
|
||||
{{ key }}: {{ value }}
|
||||
|
||||
Reference in New Issue
Block a user