From d0ff79d1916412428f2a8eaff8ca89b57e35916c Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 11 Jun 2020 09:36:45 +0200 Subject: [PATCH] fix bug, only count unique unread tasks --- Models/TaskMapper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Models/TaskMapper.php b/Models/TaskMapper.php index fef0f93..33f902e 100755 --- a/Models/TaskMapper.php +++ b/Models/TaskMapper.php @@ -335,7 +335,7 @@ final class TaskMapper extends DataMapperAbstract int $relations = RelationType::ALL, int $depth = 3 ) : array { - $depth = 3; + $depth = 3; $userWhere = new Where(self::$db); $userWhere->where(AccountRelationMapper::getTable() . '.task_account_account', '=', $user) ->orWhere(self::$table . '_' . $depth . '.task_created_by', '=', $user); @@ -377,7 +377,7 @@ final class TaskMapper extends DataMapperAbstract int $relations = RelationType::ALL, int $depth = 3 ) : array { - $depth = 3; + $depth = 3; $userWhere = new Where(self::$db); $userWhere->where(AccountRelationMapper::getTable() . '.task_account_account', '=', $user) ->orWhere(self::$table . '_' . $depth . '.task_created_by', '=', $user); @@ -407,7 +407,7 @@ final class TaskMapper extends DataMapperAbstract */ public static function hasReadingPermission(int $user, int $task) : bool { - $depth = 1; + $depth = 1; $userWhere = new Where(self::$db); $userWhere->where(AccountRelationMapper::getTable() . '.task_account_account', '=', $user) ->orWhere(self::$table . '_' . $depth . '.task_created_by', '=', $user); @@ -441,7 +441,7 @@ final class TaskMapper extends DataMapperAbstract try { $query = new Builder(self::$db); - $query->count('*') + $query->count('DISTINCT ' . self::$table . '.' . self::$primaryField) ->from(self::$table) ->innerJoin(TaskElementMapper::getTable()) ->on(self::$table . '.task_id', '=', TaskElementMapper::getTable() . '.task_element_task')