Merged in [19074] from kivinen@iki.fi:

Adds new filtering tags for sessions which have multiple sessions. I.e., in addition to wg,area,type there is wg-sessa, wg-sessb or wg-sessc etc on the tags, so now you can filter either all wg sessions or only specific sessions. Also removes the unused session.order_number, but not yet the session.order_in_meeting() function (which I think is unused too).
 - Legacy-Id: 19080
Note: SVN reference [19074] has been migrated to Git commit ddefdecca7
This commit is contained in:
Robert Sparks 2021-06-04 20:21:49 +00:00
commit 3571a4cd86
5 changed files with 17 additions and 9 deletions

View file

@ -194,7 +194,6 @@ def preprocess_assignments_for_agenda(assignments_queryset, meeting, extra_prefe
for a in assignments:
if a.session:
a.session.historic_group = None
a.session.order_number = None
if a.session.group and a.session.group not in groups:
groups.append(a.session.group)
@ -217,9 +216,6 @@ def preprocess_assignments_for_agenda(assignments_queryset, meeting, extra_prefe
if a.session.historic_group.parent_id:
parent_id_set.add(a.session.historic_group.parent_id)
l = sessions_for_groups.get((a.session.group, a.session.type_id), [])
a.session.order_number = l.index(a) + 1 if a in l else 0
parents = Group.objects.filter(pk__in=parent_id_set)
parent_replacements = find_history_replacements_active_at(parents, meeting_time)
@ -264,6 +260,9 @@ def filter_keywords_for_session(session):
if group.state_id == 'bof':
keywords.add('bof')
keywords.add(group.acronym.lower())
token = session.docname_token_only_for_multiple()
if token is not None:
keywords.add(group.acronym.lower() + "-" + token)
area = getattr(group, 'historic_parent', group.parent)
# Only sessions belonging to "regular" groups should respond to the

View file

@ -1193,6 +1193,13 @@ class Session(models.Model):
sess_mtg = Session.objects.filter(meeting=self.meeting, group=self.group).order_by('pk')
index = list(sess_mtg).index(self)
return 'sess%s' % (string.ascii_lowercase[index])
def docname_token_only_for_multiple(self):
sess_mtg = Session.objects.filter(meeting=self.meeting, group=self.group).order_by('pk')
if len(list(sess_mtg)) > 1:
index = list(sess_mtg).index(self)
return 'sess%s' % (string.ascii_lowercase[index])
return None
def constraints(self):
return Constraint.objects.filter(source=self.group, meeting=self.meeting).order_by('name__name', 'target__acronym', 'person__name').prefetch_related("source","target","person")

View file

@ -81,6 +81,9 @@ class HelpersTests(TestCase):
])
if bof:
expected_filter_keywords.add('bof')
token = assignment.session.docname_token_only_for_multiple()
if token is not None:
expected_filter_keywords.update([expected_group.acronym + "-" + token])
self.assertCountEqual(
assignment.filter_keywords,

View file

@ -2167,8 +2167,6 @@ def session_details(request, num, acronym):
qs = [p for p in qs if p.document.get_state_slug(p.document.type_id)!='deleted']
session.type_counter.update([p.document.type.slug for p in qs])
session.order_number = session.order_in_meeting()
# we somewhat arbitrarily use the group of the last session we get from
# get_sessions() above when checking can_manage_session_materials()
can_manage = can_manage_session_materials(request.user, session.group, session)

View file

@ -5,15 +5,16 @@
# to this file in trunk/ by the merge master, and it will also be included in
# the merge list.
/personal/kivinen/7.30.1.dev0@19074
# --- Add entries at the top ---
#
/personal/housley/7.30.1.dev0@19052
/personal/housley/7.30.1.dev0@19048
/personal/housley/7.26.1.dev0@18993
# --- Add entries at the top ---
#/personal/rcross/7.30.1.dev0@19035 (manually merged at 19059
/personal/housley/7.26.1.dev0@18913