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.
This commit is contained in:
Jennifer Richards 2023-11-28 16:06:36 -04:00 committed by GitHub
parent 0fa51e9016
commit d1909fd0c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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])