Hi, i've digged a little bit in the code and imho the email notification feature is correctly implemented.
What i found instead is that there is a little constraint when this notification should be sent. Basically only from "Advocacies have been approved" status to "Wating to AM to confirm" status this notification is sent. My claim is basically that in a workflow level users are not so accurate and the code could take care of it. In the attached patch i propose to relax this constraint and notify, for completeness, the admin that is trying to assign an AM, that some steps are being skipped. Sorry for my terrible english. Bests, efkin. --- P.S.: The patch was created using `git format-patch`
From 2a4f819268c02d788c7527a03a27b3d1e35db141 Mon Sep 17 00:00:00 2001 From: efkin <ef...@riseup.net> Date: Sat, 5 Mar 2016 17:01:05 +0100 Subject: [PATCH] Relax notification constraints and add verbosity to the process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AM can be assigned in different steps of the process and it must be notificated whenever it happens. So this commit relaxes the constraints for this specific notification to be sent. For the sake of completeness, the admin should be also notified that the assignment that tries to accomplish it is skipping some steps of the process. Hopefully fixes #782616 Reported by: Santiago Ruano Rincón Author: efkin --- backend/notifications.py | 7 +++++-- restricted/templates/restricted/assign-am.html | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/notifications.py b/backend/notifications.py index a1de1d7..2122858 100644 --- a/backend/notifications.py +++ b/backend/notifications.py @@ -63,10 +63,13 @@ def maybe_notify_applicant_on_progress(log, previous_log): ################################################################ # * When an AM is assigned to an applicant - # This happens when Process.progress goes from app_ok to am_rcvd + # This happens when Process.progress goes from + # adv_rcvd, poll_sent or app_ok to am_rcvd ################################################################ - if from_progress == const.PROGRESS_APP_OK: + if from_progress in (const.PROGRESS_ADV_RCVD, + const.PROGRESS_POLL_SENT, + const.PROGRESS_APP_OK): if to_progress == const.PROGRESS_AM_RCVD: # mail applicant in the queue to get an AM assigned send_notification( diff --git a/restricted/templates/restricted/assign-am.html b/restricted/templates/restricted/assign-am.html index 4e474c5..b8d7c27 100644 --- a/restricted/templates/restricted/assign-am.html +++ b/restricted/templates/restricted/assign-am.html @@ -39,7 +39,12 @@ $(main); {% block content %} <h1>Assign AM to {{person.fullname}}</h1> - +{% if process.progress != 'app_ok' %} +<h3> + Remember that this applicant has pending advocacies and they will + be automatically approved if you assign it an AM. +</h3> +{% endif %} <table class="tablesorter"> <thead> <tr> -- 2.1.4