summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorCraig Crosby <creecros@gmail.com>2019-07-02 22:52:22 -0400
committerfguillot <fred@kanboard.net>2019-07-02 19:52:22 -0700
commit48acf99fd10da2bb755d56f9dfd7c0210e76abeb (patch)
tree042eff2af1822c77b40591d938f5eafe26add05a /app/Model
parentefed94b23d592647f889ef03b144a91e8fbb6098 (diff)
Sort columns by due date
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/TaskReorderModel.php17
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;