From 48acf99fd10da2bb755d56f9dfd7c0210e76abeb Mon Sep 17 00:00:00 2001 From: Craig Crosby Date: Tue, 2 Jul 2019 22:52:22 -0400 Subject: Sort columns by due date --- app/Model/TaskReorderModel.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/Model') diff --git a/app/Model/TaskReorderModel.php b/app/Model/TaskReorderModel.php index db72274c..c7fc6f6d 100644 --- a/app/Model/TaskReorderModel.php +++ b/app/Model/TaskReorderModel.php @@ -61,6 +61,23 @@ class TaskReorderModel extends Base $this->db->closeTransaction(); } + public function reorderByDueDate($projectID, $swimlaneID, $columnID, $direction) + { + $this->db->startTransaction(); + + $taskIDs = $this->db->table(TaskModel::TABLE) + ->eq('project_id', $projectID) + ->eq('swimlane_id', $swimlaneID) + ->eq('column_id', $columnID) + ->orderBy('date_due', $direction) + ->asc('id') + ->findAllByColumn('id'); + + $this->reorderTasks($taskIDs); + + $this->db->closeTransaction(); + } + protected function reorderTasks(array $taskIDs) { $i = 1; -- cgit v1.2.3