Skip to content

Commit

Permalink
fix: Combine Group and GroupHistory when counting (#6701)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
jennifer-richards authored Nov 28, 2023
1 parent 0fa51e9 commit d1909fd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ietf/meeting/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,21 @@ def _group_filter_headings(self):
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])
Expand Down

0 comments on commit d1909fd

Please sign in to comment.