diff options
Diffstat (limited to 'app/Model')
-rw-r--r-- | app/Model/TaskReorderModel.php | 17 |
1 files changed, 17 insertions, 0 deletions
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; |