From 8b9459b8968cf5504565b759ca26cd1c2c8820cf Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Mon, 15 Jan 2024 10:47:52 +0100 Subject: [PATCH] Fix history view loading time --- application/controllers/HistoryController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/application/controllers/HistoryController.php b/application/controllers/HistoryController.php index a1b873b2a..3d53c040d 100644 --- a/application/controllers/HistoryController.php +++ b/application/controllers/HistoryController.php @@ -77,7 +77,15 @@ public function indexAction() $history->limit($page * $limitControl->getLimit()); } - $history->filter(Filter::lessThanOrEqual('event_time', $before)); + $eventTimeQuery = History::on($db) + ->columns(['id']) + ->filter(Filter::lessThanOrEqual('event_time', $before)) + ->assembleSelect() + ->resetOrderBy(); + + $history->getSelectBase() + ->where(['history.id IN (?)' => $eventTimeQuery]); + $this->filter($history, $filter); $history->getWith()['history.host']->setJoinType('LEFT');