From 51b3d811e180656f7cc3ca75e071ceaef2d5bd46 Mon Sep 17 00:00:00 2001 From: Rafael de Camargo Date: Sun, 25 Aug 2019 01:49:52 -0300 Subject: Changes filters from in array to in subqueries Fixes #3280 --- app/Filter/TaskSubtaskAssigneeFilter.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'app/Filter/TaskSubtaskAssigneeFilter.php') diff --git a/app/Filter/TaskSubtaskAssigneeFilter.php b/app/Filter/TaskSubtaskAssigneeFilter.php index 46553a3d..1096bf64 100644 --- a/app/Filter/TaskSubtaskAssigneeFilter.php +++ b/app/Filter/TaskSubtaskAssigneeFilter.php @@ -78,13 +78,7 @@ class TaskSubtaskAssigneeFilter extends BaseFilter implements FilterInterface */ public function apply() { - $task_ids = $this->getSubQuery()->findAllByColumn('task_id'); - - if (! empty($task_ids)) { - $this->query->in(TaskModel::TABLE.'.id', $task_ids); - } else { - $this->query->eq(TaskModel::TABLE.'.id', 0); // No match - } + $this->query->inSubquery(TaskModel::TABLE.'.id', $this->getSubQuery()); } /** @@ -96,12 +90,7 @@ class TaskSubtaskAssigneeFilter extends BaseFilter implements FilterInterface protected function getSubQuery() { $subquery = $this->db->table(SubtaskModel::TABLE) - ->columns( - SubtaskModel::TABLE.'.user_id', - SubtaskModel::TABLE.'.task_id', - UserModel::TABLE.'.name', - UserModel::TABLE.'.username' - ) + ->columns(SubtaskModel::TABLE.'.task_id') ->join(UserModel::TABLE, 'id', 'user_id', SubtaskModel::TABLE) ->neq(SubtaskModel::TABLE.'.status', SubtaskModel::STATUS_DONE); -- cgit v1.2.3