From fa441e8b6188e94bd6b1272b15c0adfec47227b2 Mon Sep 17 00:00:00 2001 From: Neil Muller Date: Sat, 25 Nov 2023 15:57:20 +0200 Subject: [PATCH 1/2] Redisplay talks if we replace them in the schedule This fixes a bug where talks that are replaced by dragging over them are not redisplayed in the 'Unassigned Talks' list. --- wafer/static/js/edit_schedule.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wafer/static/js/edit_schedule.js b/wafer/static/js/edit_schedule.js index ed76ac85..2d613580 100644 --- a/wafer/static/js/edit_schedule.js +++ b/wafer/static/js/edit_schedule.js @@ -143,6 +143,19 @@ e.dataTransfer.getData('text/plain')); var scheduleItemId = data.getAttribute('data-scheduleitem-id'); var scheduleItemType = data.getAttribute('data-type'); + + var curScheduleItemId = e.target.getAttribute('data-scheduleitem-id'); + if (curScheduleItemId) + { + var curType = e.target.getAttribute('data-type'); + if (curType == 'talk') + { + // Need to redisplay the talk we're removing + var curId = e.target.getAttribute('data-talk-id'); + var oldUnassigned = document.getElementById("talk" + curId); + oldUnassigned.hidden = false; + } + } e.target.innerHTML = data.getAttribute('title'); e.target.setAttribute('data-scheduleitem-id', scheduleItemId); e.target.setAttribute('data-type', scheduleItemType); From 90add495020f21f548673bba4d5c39c0d02158bf Mon Sep 17 00:00:00 2001 From: Neil Muller Date: Thu, 30 Nov 2023 15:30:06 +0200 Subject: [PATCH 2/2] Remove expectedFailure tag from test --- wafer/schedule/tests/test_schedule_editor.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/wafer/schedule/tests/test_schedule_editor.py b/wafer/schedule/tests/test_schedule_editor.py index 4f46a38d..556f2440 100644 --- a/wafer/schedule/tests/test_schedule_editor.py +++ b/wafer/schedule/tests/test_schedule_editor.py @@ -353,10 +353,8 @@ def test_swicth_day(self): with self.assertRaises(NoSuchElementException): self.driver.find_element(By.ID, f"scheduleItem{item2.pk}") - @expectedFailure def test_drag_over_talk(self): """Test that dragging over an item replaces it""" - # Expected to fail - see https://github.com/CTPUG/wafer/issues/689 # Create a schedule with a single item item1 = ScheduleItem.objects.create(venue=self.venues[0], talk_id=self.talk1.pk) @@ -403,7 +401,6 @@ def test_drag_over_talk(self): if self.talk2.title in x.text: found2 = True self.assertFalse(found2) - # FIXME: The schedule editor doesn't do this correctly self.assertTrue(found1) def test_drag_over_page(self):