From 347b62cbb52afb58f06b3afedd4dec43a3c7a8d8 Mon Sep 17 00:00:00 2001
From: Jennifer Richards <jennifer@painless-security.com>
Date: Mon, 15 Nov 2021 21:48:43 +0000
Subject: [PATCH] Fix error in assignment_display_name() and fix broken test
 from previous commit. Range 19665:19666 ready for merge.  - Legacy-Id: 19666

---
 ietf/meeting/templatetags/agenda_custom_tags.py |  2 +-
 ietf/meeting/templatetags/tests.py              | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/ietf/meeting/templatetags/agenda_custom_tags.py b/ietf/meeting/templatetags/agenda_custom_tags.py
index 0bdd9d222..e3dc79068 100644
--- a/ietf/meeting/templatetags/agenda_custom_tags.py
+++ b/ietf/meeting/templatetags/agenda_custom_tags.py
@@ -72,7 +72,7 @@ def webcal_url(context, viewname, *args, **kwargs):
 @register.simple_tag
 def assignment_display_name(assignment):
     """Get name for an assignment"""
-    if assignment.session.type.slug == 'session' and assignment.session.historic_group:
+    if assignment.session.type.slug == 'regular' and assignment.session.historic_group:
         return assignment.session.historic_group.name
     return assignment.session.name or assignment.timeslot.name
 
diff --git a/ietf/meeting/templatetags/tests.py b/ietf/meeting/templatetags/tests.py
index 2734a57cd..270bc2eb0 100644
--- a/ietf/meeting/templatetags/tests.py
+++ b/ietf/meeting/templatetags/tests.py
@@ -3,7 +3,7 @@
 
 from django.template import Context, Template
 
-from ietf.meeting.factories import TimeSlotFactory
+from ietf.meeting.factories import FloorPlanFactory, RoomFactory, TimeSlotFactory
 from ietf.meeting.templatetags.agenda_custom_tags import AnchorNode
 from ietf.utils.test_utils import TestCase
 
@@ -23,10 +23,12 @@ class AgendaCustomTagsTests(TestCase):
                 pass  # any other failure ok since we used garbage inputs
 
     def test_location_anchor_node(self):
+        floorplan = FloorPlanFactory(meeting__type_id='ietf')
+        room = RoomFactory(meeting=floorplan.meeting, floorplan=floorplan)
         context = Context({
-            'no_location': TimeSlotFactory(location='none'),
-            'no_show_location': TimeSlotFactory(show_location=False),
-            'show_location': TimeSlotFactory(location__name='My Location'),
+            'no_location': TimeSlotFactory(meeting=room.meeting, location='none'),
+            'no_show_location': TimeSlotFactory(meeting=room.meeting, show_location=False),
+            'show_location': TimeSlotFactory(meeting=room.meeting, location=room),
         })
         template = Template("""
             {% load agenda_custom_tags %}