Improve dashboard
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user