Repository: ietf-tools/datatracker

Issue:
Wrong group type in scheduling request email response
`keyword_sprint` `type_defect`   |    by lars@eggert.org

___


"Working Group" should be replaced by group type everywhere. "Area Name" is also confusing, since the IRTF isn't an area.

```
A new meeting session request has just been submitted by Lars Eggert, a Chair of the irtfopen working group.


---------------------------------------------------------
Working Group Name: IRTF Open Meeting
Area Name: IRTF
Session Requester: Lars Eggert

Number of Sessions: 1
Length of Session(s):  1.5 Hours
Number of Attendees: 200
Conflicts to Avoid: 
First Priority: maprg gaia cfrg hrpc iccrg icnrg nfvrg  nmrg nwcrg sdnrg t2trg quic




Special Requests:
 Ideally, schedule early in the week but after the IAB plenary. Avoid overlapping with all IRTF sessions and IETF area meetings, and ideally BoFs.

```

___
_Issue migrated from trac:2120 at 2022-03-04 05:38:01 +0000_


Discussion:
_@rjsparks@nostrum.com_ _changed priority from `n/a` to `medium`_
_@rjsparks@nostrum.com_ _changed component from `doc/` to `meeting/`_
_@rjsparks@nostrum.com_ _commented_


___
This isn't quite as easy as it looks, but we can make some improvements.

First - it's good you used irtfopen as an example. It's currently configured as an Area Group (or 'AG') not a Research Group. It's probably right that it's something analogous to an Area Group, but we probably want a new group type to indicate what it really is.

When this is implemented: the string you're hoping to use lives in GroupTypeName.verbose_name


_@rjsparks@nostrum.com_ _changed keywords from `` to `sprint`_
_@rjsparks@nostrum.com_ _changed status from `new` to `under_review`_
_@rjsparks@nostrum.com_ _commented_


___
Several things have changed since this was last discussed. We need to look at the group type settings and see if this is still an issue. If so, it should be easier to fix than it was at the time of the original report.

Resolving patch:
diff --git a/ietf/secr/sreq/views.py b/ietf/secr/sreq/views.py
--- a/ietf/secr/sreq/views.py
+++ b/ietf/secr/sreq/views.py
@@ -3,6 +3,7 @@
 
 
 import datetime
+import inflect
 from collections import defaultdict, OrderedDict
 
 from django.conf import settings
@@ -105,18 +106,29 @@ def get_lock_message(meeting=None):
         meeting = get_meeting(days=14)
     return meeting.session_request_lock_message
 
-def get_requester_text(person,group):
-    '''
-    This function takes a Person object and a Group object and returns the text to use in the
-    session request notification email, ie. Joe Smith, a Chair of the ancp working group
-    '''
-    roles = group.role_set.filter(name__in=('chair','secr'),person=person)
+
+def get_requester_text(person, group):
+    """
+    This function takes a Person object and a Group object and returns the text to use
+    in the session request notification email, ie. Joe Smith, a Chair of the ancp
+    working group
+    """
+    roles = group.role_set.filter(name__in=("chair", "secr", "ad"), person=person)
     if roles:
-        return '%s, a %s of the %s working group' % (person.ascii, roles[0].name, group.acronym)
-    if group.parent and group.parent.role_set.filter(name='ad',person=person):
-        return '%s, a %s Area Director' % (person.ascii, group.parent.acronym.upper())
-    if person.role_set.filter(name='secr',group__acronym='secretariat'):
-        return '%s, on behalf of the %s working group' % (person.ascii, group.acronym)
+        rolename = str(roles[0].name)
+        return "%s, %s of the %s %s" % (
+            person.name,
+            inflect.engine().a(rolename),
+            group.acronym.upper(),
+            group.type.verbose_name,
+        )
+    if person.role_set.filter(name="secr", group__acronym="secretariat"):
+        return "%s, on behalf of the %s %s" % (
+            person.name,
+            group.acronym.upper(),
+            group.type.verbose_name,
+        )
+
 
 def save_conflicts(group, meeting, conflicts, name):
     '''


Test patch: