diff options
author | Craig Crosby <creecros@gmail.com> | 2019-07-02 22:52:22 -0400 |
---|---|---|
committer | fguillot <fred@kanboard.net> | 2019-07-02 19:52:22 -0700 |
commit | 48acf99fd10da2bb755d56f9dfd7c0210e76abeb (patch) | |
tree | 042eff2af1822c77b40591d938f5eafe26add05a /app/Model | |
parent | efed94b23d592647f889ef03b144a91e8fbb6098 (diff) |
Sort columns by due date
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; |