From c7f1306df183728a164bc8dedc6d14391e4a0cb7 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 16 Sep 2022 16:19:01 +0200 Subject: [PATCH] adding athlete last name to alert --- rowers/dataprep.py | 14 ++++++++++++++ rowers/management/commands/processalerts.py | 1 + rowers/tasks.py | 4 +++- rowers/templates/alertemail.html | 4 ++-- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 86f13ab6..a02c5ce3 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -980,6 +980,13 @@ def checkbreakthrough(w, r): r.user.first_name, r.user.last_name, btvalues=btvalues.to_json()) + for coach in r.get_coaches(): + _ = myqueue(queuehigh, handle_sendemail_breakthrough, + w.id, + coach.user.email, + r.user.first_name, + r.user.last_name, + btvalues=btvalues.to_json()) # submit email task to send email about breakthrough workout if ishard: # pragma: no cover @@ -993,6 +1000,13 @@ def checkbreakthrough(w, r): r.user.first_name, r.user.last_name, btvalues=btvalues.to_json()) + for coach in r.get_coaches(): + _ = myqueue(queuehigh, handle_sendemail_hard, + w.id, + coach.user.email, + r.user.first_name, + r.user.last_name, + btvalues=btvalues.to_json()) return isbreakthrough, ishard diff --git a/rowers/management/commands/processalerts.py b/rowers/management/commands/processalerts.py index d910de93..04ca937c 100644 --- a/rowers/management/commands/processalerts.py +++ b/rowers/management/commands/processalerts.py @@ -52,6 +52,7 @@ class Command(BaseCommand): alert.manager.first_name, alert.manager.last_name, alert.rower.user.first_name, + alert.rower.user.last_name, alert.name, stats, debug=True, othertexts=othertexts) diff --git a/rowers/tasks.py b/rowers/tasks.py index f6499009..f9c3e990 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -1304,7 +1304,8 @@ def sigdig(value, digits=3): @app.task def handle_send_email_alert( - useremail, userfirstname, userlastname, rowerfirstname, alertname, stats, **kwargs): + useremail, userfirstname, userlastname, rowerfirstname, rowerlastname, + alertname, stats, **kwargs): if 'othertexts' in kwargs: # pragma: no cover othertexts = kwargs['othertexts'] @@ -1356,6 +1357,7 @@ def handle_send_email_alert( 'enddate': stats['enddate'], 'siteurl': siteurl, 'rowerfirstname': rowerfirstname, + 'rowerlastname': rowerlastname, 'alertname': alertname, 'othertexts': othertexts, } diff --git a/rowers/templates/alertemail.html b/rowers/templates/alertemail.html index 1d737ccc..39fc8dae 100644 --- a/rowers/templates/alertemail.html +++ b/rowers/templates/alertemail.html @@ -4,7 +4,8 @@

Dear {{ first_name }},

- Here is the report for your alert {{ alertname }} on rowsandall.com. This is a report for your athlete {{ rowerfirstname }}, covering the period from + Here is the report for your alert {{ alertname }} on rowsandall.com. + This is a report for your athlete {{ rowerfirstname }} {{ rowerlastname }}, covering the period from {{ startdate }} to {{ enddate }}.

@@ -24,4 +25,3 @@ Best Regards, the Rowsandall Team

{% endblock %} -