From 6378eed239980e4ce5106435b4731405029500ff Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 2 Apr 2024 21:40:48 +0000 Subject: [PATCH] template fixes + bug fixes + style fixes --- Controller/BackendController.php | 10 +++++----- Controller/SearchController.php | 4 ++-- Theme/Backend/task-list.tpl.php | 4 ++-- tests/Models/TaskMapperTest.php | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 7680167..1663fbb 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -88,7 +88,7 @@ public function viewTaskDashboard(RequestAbstract $request, ResponseAbstract $re ->where('status', TaskStatus::OPEN) ->sort('createdAt', OrderType::DESC) ->query($openQuery) - ->execute(); + ->executeGetArray(); $view->data['open'] = $open; @@ -114,7 +114,7 @@ public function viewTaskDashboard(RequestAbstract $request, ResponseAbstract $re ->where('status', TaskStatus::OPEN) ->where('createdBy', $response->header->account, '=') ->sort('createdAt', OrderType::DESC) - ->execute(); + ->executeGetArray(); $view->data['given'] = $given; @@ -183,10 +183,10 @@ public function viewTaskList(RequestAbstract $request, ResponseAbstract $respons } if ($request->getData('ptype') === 'p') { - $view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '<') + $view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('offset') ?? 0, '<') ->executeGetArray(); } elseif ($request->getData('ptype') === 'n') { - $view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>') + $view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('offset') ?? 0, '>') ->executeGetArray(); } else { $view->data['tasks'] = $mapperQuery->where('id', 0, '>') @@ -315,7 +315,7 @@ public function viewTaskView(RequestAbstract $request, ResponseAbstract $respons ->with('reminderBy') ->where('task', $task->id) ->where('seenBy', $request->header->account) - ->execute(); + ->executeGetArray(); foreach ($taskSeen as $unseen) { // Shows all reminders diff --git a/Controller/SearchController.php b/Controller/SearchController.php index e67462b..8704551 100755 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -65,7 +65,7 @@ public function searchTag(RequestAbstract $request, ResponseAbstract $response, ->sort('taskElements/createdAt', OrderType::ASC) ->limit(8) //->limit(1, 'taskElements') - ->execute(); + ->executeGetArray(); $results = []; $count = 0; @@ -132,7 +132,7 @@ public function searchGeneral(RequestAbstract $request, ResponseAbstract $respon ->sort('taskElements/createdAt', OrderType::ASC) ->limit(8) //->limit(1, 'taskElements') - ->execute(); + ->executeGetArray(); $results = []; $count = 0; diff --git a/Theme/Backend/task-list.tpl.php b/Theme/Backend/task-list.tpl.php index 7446ac7..920c4f5 100644 --- a/Theme/Backend/task-list.tpl.php +++ b/Theme/Backend/task-list.tpl.php @@ -19,8 +19,8 @@ /** @var \Modules\Tasks\Models\Task[] $tasks */ $tasks = $this->data['tasks'] ?? []; -$previous = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&id=' . \reset($tasks)->id . '&ptype=p'; -$next = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&id=' . \end($tasks)->id . '&ptype=n'; +$previous = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&offset=' . \reset($tasks)->id . '&ptype=p'; +$next = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&offset=' . \end($tasks)->id . '&ptype=n'; echo $this->data['nav']->render(); ?> diff --git a/tests/Models/TaskMapperTest.php b/tests/Models/TaskMapperTest.php index 96a547d..de59ce4 100755 --- a/tests/Models/TaskMapperTest.php +++ b/tests/Models/TaskMapperTest.php @@ -139,7 +139,7 @@ public function testCRUD() : void #[\PHPUnit\Framework\Attributes\Group('module')] public function testNewest() : void { - $newest = TaskMapper::getAll()->sort('id', OrderType::DESC)->limit(1)->execute(); + $newest = TaskMapper::getAll()->sort('id', OrderType::DESC)->limit(1)->executeGetArray(); self::assertCount(1, $newest); }