From 30469dbd03b0e69ae33abfcbee88ef2251d62345 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 18 Feb 2018 10:29:08 +0200 Subject: [PATCH] Check kanban statuses are in sequential order --- app/Http/Controllers/TaskKanbanController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/TaskKanbanController.php b/app/Http/Controllers/TaskKanbanController.php index b493c784d7a8..f00be58d7f92 100644 --- a/app/Http/Controllers/TaskKanbanController.php +++ b/app/Http/Controllers/TaskKanbanController.php @@ -55,8 +55,16 @@ class TaskKanbanController extends BaseController $task->task_status_sort_order = $i++; $task->save(); } - // otherwise, check that the tasks orders are correct + // otherwise, check that the orders are correct } else { + for ($i=0; $i<$statuses->count(); $i++) { + $status = $statuses[$i]; + if ($status->sort_order != $i) { + $status->sort_order = $i; + $status->save(); + } + } + $firstStatus = $statuses[0]; $counts = []; foreach ($tasks as $task) {