Improve dashboard

This commit is contained in:
Frederic Guillot
2017-04-08 13:58:25 -04:00
parent fe9f3ba707
commit d7b0cfbbe5
21 changed files with 493 additions and 30 deletions

View File

@@ -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;
}
}