Skip to content

Commit 6cfbab6

Browse files
fix: Use session name instead of timeslot name on agenda (ietf-tools#5086)
* fix: Use session name instead of timeslot name on agenda * test: Fix failing playwright test * test: Test name/slotName values from agenda_extract_schedule() * chore: Migrate sessions to use timeslot names for IETF meetings
1 parent 9a673a2 commit 6cfbab6

5 files changed

Lines changed: 84 additions & 5 deletions

File tree

client/agenda/AgendaScheduleList.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,17 @@ const meetingEvents = computed(() => {
257257
acc.lastDate = itemDate.toISODate()
258258
259259
// -> Add session header row
260-
if (item.type === 'regular' && acc.lastTypeName !== `${item.type}-${item.name}`) {
260+
const typeName = `${item.type}-${item.slotName}`
261+
if (item.type === 'regular' && acc.lastTypeName !== typeName) {
261262
acc.result.push({
262263
key: `sesshd-${item.id}`,
263264
displayType: 'session-head',
264265
timeslot: itemTimeSlot,
265-
name: `${item.adjustedStart.toFormat('cccc')} ${item.name}`,
266+
name: `${item.adjustedStart.toFormat('cccc')} ${item.slotName}`,
266267
cssClasses: 'agenda-table-display-session-head' + (isLive ? ' agenda-table-live' : '')
267268
})
268269
}
269-
acc.lastTypeName = `${item.type}-${item.name}`
270+
acc.lastTypeName = typeName
270271
271272
// -> Populate event links
272273
const links = []
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Generated by Django 2.2.28 on 2023-02-06 22:20
2+
from django.db import migrations
3+
from django.db.models import ExpressionWrapper, F, IntegerField
4+
5+
6+
def forward(apps, schema_editor):
7+
Meeting = apps.get_model('meeting', 'Meeting')
8+
meetings = Meeting.objects.filter(type='ietf', schedule__isnull=False).annotate(
9+
number_as_int=ExpressionWrapper(F('number'), output_field=IntegerField())
10+
).order_by('date')
11+
# print('session.pk,meeting.number,session.name,timeslot.name')
12+
for m in meetings.filter(number_as_int__lt=91):
13+
# until meeting 91, TimeSlots had the more descriptive names
14+
for assignment in m.schedule.assignments.exclude(session__type='regular').exclude(session__name=F('timeslot__name')):
15+
# print(f'{assignment.session.pk},{m.number},{assignment.session.name},{assignment.timeslot.name}')
16+
assignment.session.name = assignment.timeslot.name
17+
assignment.session.save()
18+
19+
# meetings 91-98 had no differences or were better off with session names as they were
20+
21+
for m in meetings.filter(number_as_int__gte=99):
22+
# for meetings 99+, TimeSlots again had the better names
23+
for assignment in m.schedule.assignments.exclude(session__type='regular').exclude(session__name=F('timeslot__name')):
24+
# print(f'{assignment.session.pk},{m.number},{assignment.session.name},{assignment.timeslot.name}')
25+
assignment.session.name = assignment.timeslot.name
26+
assignment.session.save()
27+
28+
29+
def reverse(apps, schema_editor):
30+
pass # can't undo
31+
32+
33+
class Migration(migrations.Migration):
34+
35+
dependencies = [
36+
('meeting', '0058_meeting_time_zone_not_blank'),
37+
]
38+
39+
operations = [
40+
migrations.RunPython(forward, reverse),
41+
]

ietf/meeting/tests_views.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,42 @@ def test_agenda_extract_schedule_location(self):
172172
self.assertEqual(shown['room'], room.name)
173173
self.assertEqual(shown['location'], {'name': room.floorplan.name, 'short': room.floorplan.short})
174174

175+
def test_agenda_extract_schedule_names(self):
176+
meeting = MeetingFactory(type_id='ietf')
177+
named_timeslots = TimeSlotFactory.create_batch(2, meeting=meeting, name='Timeslot Name')
178+
unnamed_timeslots = TimeSlotFactory.create_batch(2, meeting=meeting, name='')
179+
named_sessions = SessionFactory.create_batch(2, meeting=meeting, name='Session Name')
180+
unnamed_sessions = SessionFactory.create_batch(2, meeting=meeting, name='')
181+
pk_with = {
182+
'both named': named_sessions[0].timeslotassignments.create(
183+
schedule=meeting.schedule,
184+
timeslot=named_timeslots[0],
185+
).pk,
186+
'session named': named_sessions[1].timeslotassignments.create(
187+
schedule=meeting.schedule,
188+
timeslot=unnamed_timeslots[0],
189+
).pk,
190+
'timeslot named': unnamed_sessions[0].timeslotassignments.create(
191+
schedule=meeting.schedule,
192+
timeslot=named_timeslots[1],
193+
).pk,
194+
'neither named': unnamed_sessions[1].timeslotassignments.create(
195+
schedule=meeting.schedule,
196+
timeslot=unnamed_timeslots[1],
197+
).pk,
198+
}
199+
processed = preprocess_assignments_for_agenda(meeting.schedule.assignments.all(), meeting)
200+
AgendaKeywordTagger(assignments=processed).apply()
201+
extracted = {item.pk: agenda_extract_schedule(item) for item in processed}
202+
self.assertEqual(extracted[pk_with['both named']]['name'], 'Session Name')
203+
self.assertEqual(extracted[pk_with['both named']]['slotName'], 'Timeslot Name')
204+
self.assertEqual(extracted[pk_with['session named']]['name'], 'Session Name')
205+
self.assertEqual(extracted[pk_with['session named']]['slotName'], '')
206+
self.assertEqual(extracted[pk_with['timeslot named']]['name'], '')
207+
self.assertEqual(extracted[pk_with['timeslot named']]['slotName'], 'Timeslot Name')
208+
self.assertEqual(extracted[pk_with['neither named']]['name'], '')
209+
self.assertEqual(extracted[pk_with['neither named']]['slotName'], '')
210+
175211

176212
class MeetingTests(BaseMeetingTestCase):
177213
def test_meeting_agenda(self):

ietf/meeting/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,8 @@ def agenda_extract_schedule (item):
17041704
} if (item.timeslot.show_location and item.timeslot.location and item.timeslot.location.floorplan) else {},
17051705
"acronym": item.acronym,
17061706
"duration": item.timeslot.duration.seconds,
1707-
"name": item.timeslot.name,
1707+
"name": item.session.name,
1708+
"slotName": item.timeslot.name,
17081709
"startDateTime": item.timeslot.time.isoformat(),
17091710
"status": item.session.current_status,
17101711
"type": item.session.type.slug,

playwright/tests/meeting/agenda.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ test.describe('past - desktop', () => {
213213
const headerRow = page.locator(`#agenda-rowid-sesshd-${event.id}`)
214214
await expect(headerRow).toBeVisible()
215215
await expect(headerRow.locator('.agenda-table-cell-ts')).toContainText(eventTimeSlot)
216-
await expect(headerRow.locator('.agenda-table-cell-name')).toContainText(`${DateTime.fromISO(event.startDateTime).toFormat('cccc')} ${event.name}`)
216+
await expect(headerRow.locator('.agenda-table-cell-name')).toContainText(`${DateTime.fromISO(event.startDateTime).toFormat('cccc')} ${event.slotName}`)
217217
}
218218
// Timeslot
219219
await expect(row.locator('.agenda-table-cell-ts')).toContainText('—')

0 commit comments

Comments
 (0)