From 4ec8e04f085f937be3efb2863d66bbc97afba250 Mon Sep 17 00:00:00 2001 From: Mae Grace Baybay <87640602+mgbaybay@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:25:55 +0800 Subject: [PATCH] Schedule Criteria: Fixed table sorting (#2782) --- lib/Factory/ScheduleFactory.php | 6 +++++- views/schedule-page.twig | 8 ++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/Factory/ScheduleFactory.php b/lib/Factory/ScheduleFactory.php index a685fad076..2c79ae7db5 100644 --- a/lib/Factory/ScheduleFactory.php +++ b/lib/Factory/ScheduleFactory.php @@ -411,7 +411,8 @@ public function query($sortOrder = null, $filterBy = []) `schedule`.updatedOn, `schedule`.name, `schedule`.dataSetId, - `schedule`.dataSetParams + `schedule`.dataSetParams, + `sc`.eventId AS criteria '; $body = ' FROM `schedule` @@ -427,6 +428,9 @@ public function query($sortOrder = null, $filterBy = []) ON `syncgroup`.syncGroupId = `schedule`.syncGroupId LEFT OUTER JOIN `user` ON `user`.userId = `schedule`.modifiedBy + LEFT OUTER JOIN ( + SELECT DISTINCT `eventId` FROM schedule_criteria + ) AS sc ON `schedule`.eventId = sc.eventId WHERE 1 = 1'; if ($parsedFilter->getInt('eventId') !== null) { diff --git a/views/schedule-page.twig b/views/schedule-page.twig index 1b12d74d82..d6b8d12706 100644 --- a/views/schedule-page.twig +++ b/views/schedule-page.twig @@ -1529,15 +1529,11 @@ responsivePriority: 2, }, { - data: 'criteria', + name: 'criteria', className: 'align-middle', responsivePriority: 2, data: function (data, type, row) { - if (data.criteria && data.criteria.length > 0) { - return dataTableTickCrossColumn(1, type, row); - } else { - return ''; - } + return (data.criteria && data.criteria.length > 0) ? dataTableTickCrossColumn(1, type, row) : '' } }, {