Allow task limits to be applied per-swimlane

This commit is contained in:
Andre Nathan
2020-01-31 19:42:06 -03:00
committed by Frédéric Guillot
parent 0a6f614571
commit e59ab08af3
15 changed files with 110 additions and 16 deletions

View File

@@ -3,6 +3,7 @@
namespace Kanboard\Formatter;
use Kanboard\Core\Filter\FormatterInterface;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\SwimlaneModel;
use Kanboard\Model\TaskModel;
@@ -43,8 +44,16 @@ class BoardFormatter extends BaseFormatter implements FormatterInterface
*/
public function format()
{
$project = $this->projectModel->getById($this->projectId);
$swimlanes = $this->swimlaneModel->getAllByStatus($this->projectId, SwimlaneModel::ACTIVE);
$columns = $this->columnModel->getAllWithTaskCount($this->projectId);
if ($project['per_swimlane_task_limits']) {
$columns = array();
foreach ($swimlanes as $swimlane) {
$columns = array_merge($columns, $this->columnModel->getAllWithPerSwimlaneTaskCount($this->projectId, $swimlane['id']));
}
} else {
$columns = $this->columnModel->getAllWithTaskCount($this->projectId);
}
if (empty($swimlanes) || empty($columns)) {
return array();