summaryrefslogtreecommitdiff
path: root/app/Filter/TaskSubtaskAssigneeFilter.php
diff options
context:
space:
mode:
authorRafael de Camargo <rafacamargo123@gmail.com>2019-08-25 01:49:52 -0300
committerFrédéric Guillot <fred@kanboard.net>2019-08-27 20:28:58 -0700
commit51b3d811e180656f7cc3ca75e071ceaef2d5bd46 (patch)
treeb6ac7fa2d18d7d5883a126cafbcba583c09f557d /app/Filter/TaskSubtaskAssigneeFilter.php
parent4d0762805448d285c2e6fba12a71b71c22496e13 (diff)
Changes filters from in array to in subqueries
Fixes #3280
Diffstat (limited to 'app/Filter/TaskSubtaskAssigneeFilter.php')
-rw-r--r--app/Filter/TaskSubtaskAssigneeFilter.php15
1 files changed, 2 insertions, 13 deletions
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);