From d1909fd0c37e833c5fe8006a0ffd52b667e1be2a Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Tue, 28 Nov 2023 16:06:36 -0400 Subject: [PATCH] fix: Combine Group and GroupHistory when counting (#6701) * fix: Combine Group and GroupHistory when counting * refactor: Use same symbol in parallel iterators * fix: Handle group acronym changes in assertion * refactor: Avoid reference to GroupHistory in assertions * chore: Revert so assertion fails on changed acronym The filtering and meeting displays disagree on how to handle this, so let's get a notification if it comes up in production. --- ietf/meeting/helpers.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ietf/meeting/helpers.py b/ietf/meeting/helpers.py index e3f4874f4..14478787f 100644 --- a/ietf/meeting/helpers.py +++ b/ietf/meeting/helpers.py @@ -317,10 +317,21 @@ class AgendaFilterOrganizer(AgendaKeywordTool): groups = set(self._get_group(s) for s in self.sessions if s and self._get_group(s)) - log.assertion('len(groups) == len(set(g.acronym for g in groups))') # no repeated acros + # Verify that we're not using the same acronym for more than one distinct group, accounting for + # the possibility that some groups are GroupHistory instances. This assertion will fail if a Group + # and GroupHistory for the same group have a different acronym - in that event, the filter will + # not match the meeting display, so we should be alerted that this has actually occurred. + log.assertion( + "len(set(getattr(g, 'group_id', g.id) for g in groups)) " + "== len(set(g.acronym for g in groups))" + ) group_parents = set(self._get_group_parent(g) for g in groups if self._get_group_parent(g)) - log.assertion('len(group_parents) == len(set(gp.acronym for gp in group_parents))') # no repeated acros + # See above for explanation of this assertion + log.assertion( + "len(set(getattr(gp, 'group_id', gp.id) for gp in group_parents)) " + "== len(set(gp.acronym for gp in group_parents))" + ) all_groups = groups.union(group_parents) all_groups.difference_update([g for g in all_groups if g.acronym in self.exclude_acronyms])