Merged in [19666] from jennifer@painless-security.com:

Fix error in assignment_display_name() and fix broken test from previous commit. Range 19665:19666
 - Legacy-Id: 19669
Note: SVN reference [19666] has been migrated to Git commit 347b62cbb5
This commit is contained in:
Robert Sparks 2021-11-16 18:42:17 +00:00
commit 4f0a3c30ff
2 changed files with 7 additions and 5 deletions

View file

@ -72,7 +72,7 @@ def webcal_url(context, viewname, *args, **kwargs):
@register.simple_tag @register.simple_tag
def assignment_display_name(assignment): def assignment_display_name(assignment):
"""Get name for an 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.historic_group.name
return assignment.session.name or assignment.timeslot.name return assignment.session.name or assignment.timeslot.name

View file

@ -3,7 +3,7 @@
from django.template import Context, Template 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.meeting.templatetags.agenda_custom_tags import AnchorNode
from ietf.utils.test_utils import TestCase from ietf.utils.test_utils import TestCase
@ -23,10 +23,12 @@ class AgendaCustomTagsTests(TestCase):
pass # any other failure ok since we used garbage inputs pass # any other failure ok since we used garbage inputs
def test_location_anchor_node(self): def test_location_anchor_node(self):
floorplan = FloorPlanFactory(meeting__type_id='ietf')
room = RoomFactory(meeting=floorplan.meeting, floorplan=floorplan)
context = Context({ context = Context({
'no_location': TimeSlotFactory(location='none'), 'no_location': TimeSlotFactory(meeting=room.meeting, location='none'),
'no_show_location': TimeSlotFactory(show_location=False), 'no_show_location': TimeSlotFactory(meeting=room.meeting, show_location=False),
'show_location': TimeSlotFactory(location__name='My Location'), 'show_location': TimeSlotFactory(meeting=room.meeting, location=room),
}) })
template = Template(""" template = Template("""
{% load agenda_custom_tags %} {% load agenda_custom_tags %}