diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-04-08 13:58:25 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-04-08 13:58:25 -0400 |
commit | d7b0cfbbe57fae9afbf9637afa7e54d3bf708747 (patch) | |
tree | ced408d01329538bd34b659018a7cd11e04aa982 /app/Formatter | |
parent | fe9f3ba707d1caf9348ae17e0566eabd505fbce2 (diff) |
Improve dashboard
Diffstat (limited to 'app/Formatter')
-rw-r--r-- | app/Formatter/TaskListSubtaskAssigneeFormatter.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/Formatter/TaskListSubtaskAssigneeFormatter.php b/app/Formatter/TaskListSubtaskAssigneeFormatter.php index 50b08cd8..73391766 100644 --- a/app/Formatter/TaskListSubtaskAssigneeFormatter.php +++ b/app/Formatter/TaskListSubtaskAssigneeFormatter.php @@ -11,6 +11,7 @@ namespace Kanboard\Formatter; class TaskListSubtaskAssigneeFormatter extends TaskListFormatter { protected $userId = 0; + protected $withoutEmptyTasks = false; /** * Set assignee @@ -24,6 +25,12 @@ class TaskListSubtaskAssigneeFormatter extends TaskListFormatter return $this; } + public function withoutEmptyTasks() + { + $this->withoutEmptyTasks = true; + return $this; + } + /** * Apply formatter * @@ -38,6 +45,12 @@ class TaskListSubtaskAssigneeFormatter extends TaskListFormatter $subtasks = array_column_index($subtasks, 'task_id'); array_merge_relation($tasks, $subtasks, 'subtasks', 'id'); + if ($this->withoutEmptyTasks) { + $tasks = array_filter($tasks, function (array $task) { + return count($task['subtasks']) > 0; + }); + } + return $tasks; } } |