Hi,

added a patch to make the ping messages for stuck processes more informative.
- list missing requirements
- for the case of a missing advocate mention, that a process can be reopened
- for the case of keychecks, mention in the first ping, 
  that this isn't taken in account for the ping.

The messages would look like the below, depending on what exactly is missing.

First ping:

Hello,

the process at https://example.com/process/40 looks stuck.

This message was triggered because the following requirements aren't 
fulfilled:

- Advocate
- Declaration of intent
- SC/DFSG/DMUP agreement

If nothing happens, the process will be automatically closed a week from now.
-> Don't worry about Key consistency checks -
   it's not taken into regard here, because it needs manual approval.
-> If you have an advocate that just needs some more time to react,
   the process can be reopened.

If you need help with anything, please mail n...@debian.org.

Housekeeping Robot for Front Desk
----------
second ping:

Hello,

the process at https://example.com/process/40 looks stuck.

This message was triggered because the following requirements aren't 
fulfilled:

- Advocate
- Declaration of intent
- SC/DFSG/DMUP agreement

A week has passed from the last ping with no action, I'll now close the
process. Feel free to reapply in the future.
-> If you have an advocate that just needs some more time to react,
   the process can be reopened.

If you need help with anything, please mail n...@debian.org.

Housekeeping Robot for Front Desk
>From 9fbabb4e9e16b2f1d7161bbcdd7b5e53353eb6e0 Mon Sep 17 00:00:00 2001
From: Judit Foglszinger <ur...@debian.org>
Date: Sun, 1 Mar 2020 11:04:37 +0600
Subject: [PATCH] make ping messages more informative.

---
 process/maintenance.py | 58 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 4 deletions(-)

diff --git a/process/maintenance.py b/process/maintenance.py
index 6e0821e..206ddc7 100644
--- a/process/maintenance.py
+++ b/process/maintenance.py
@@ -15,21 +15,71 @@ def ping_stuck_processes(stuck_cutoff, audit_author, logdate=None):
         if entry.logdate > stuck_cutoff:
             continue
 
+        # get missing requirements for process in order
+        # to be able to issue a more meaningful ping message
+
+        missing_requirements = []
+        # additional information appended to ping mail -
+        # keycheck does not count as missing requirement here, but is often misinterpreted,
+        # so append a message, if it is not approved yet.
+        keycheck_message = ""
+        # an advocate might take longer than one week to react
+        # and the applicant might not be able to influence that,
+        # so append a message, that a closed process can be reopened.
+        advocate_message = ""
+
+        for r in process.requirements.all():
+            if r.type == "advocate" or r.type == "intent" or r.type == "sc_dmup":
+                if r.approved_by == None:
+                    missing_requirements.append(r)
+            # add additional messages for missing advocate and keycheck
+            if r.type ==  "keycheck" and r.approved_by == None:
+                keycheck_message = "-> Don't worry about "+str(r)+\
+""" -
+   it's not taken into regard here, because it needs manual approval.
+"""
+            if r.type ==  "advocate" and r.approved_by == None:
+                advocate_message = \
+"""-> If you have an advocate that just needs some more time to react,
+   the process can be reopened.
+"""
+        # not having any missing requirements here would be an error,
+        # but let's don't have it look weird in the mail and omit the additional text
+        if len(missing_requirements) <= 0:
+            msg_str = ""
+        else:
+            # differentiating singular/plural
+            s = "" if len(missing_requirements) < 2 else "s"
+            be_form = "is" if len(missing_requirements) < 2 else "are"
+            msg_str = \
+"""
+This message was triggered because the following requirement"""+s+" "+be_form+"n't"+\
+""" fulfilled:
+
+"""
+            for r in missing_requirements:
+                msg_str = msg_str + "- "+str(r)+"\n"
+
         if not already_pinged:
             # Detect first instance of processes stuck early: X days from
             # last log, no previous ping message
-            ping_process(audit_author, process, message="""
+            msg_str = msg_str +\
+"""
 If nothing happens, the process will be automatically closed a week from now.
-""")
+"""+keycheck_message+advocate_message
+
+            ping_process(audit_author, process, message=msg_str)
             process.add_log(audit_author, "looks stuck, pinged",
                             action="ping", logdate=logdate)
         else:
             # Detect second instance: X days from last log, no
             # intent/advocate/sc_dmup, a previous ping message
-            ping_process(audit_author, process, message="""
+            msg_str = msg_str +\
+"""
 A week has passed from the last ping with no action, I'll now close the
 process. Feel free to reapply in the future.
-""")
+"""+advocate_message
+            ping_process(audit_author, process, message=msg_str)
             process.add_log(audit_author, "closing for inactivity",
                             action="proc_close", logdate=logdate, is_public=True)
             process.closed_by = audit_author
-- 
2.25.0

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to