Add per-project and per-swimlane task limits

This change allows projects and swimlanes to be configured with task limits that apply to their whole scope (i.e. all active tasks in a project or swimlane, respectively), as opposed to the usual per-column task limits.
This commit is contained in:
Andre Nathan
2020-02-26 01:26:31 -03:00
committed by GitHub
parent 542fd17891
commit c8a617cfcb
21 changed files with 161 additions and 27 deletions

View File

@@ -178,7 +178,7 @@ class SwimlaneModel extends Base
);
$swimlanes = $this->db->table(self::TABLE)
->columns('id', 'name', 'description', 'project_id', 'position', 'is_active')
->columns('id', 'name', 'description', 'project_id', 'position', 'is_active', 'task_limit')
->subquery("SELECT COUNT(*) FROM ".TaskModel::TABLE." WHERE swimlane_id=".self::TABLE.".id AND is_active='1'", 'nb_open_tasks')
->subquery("SELECT COUNT(*) FROM ".TaskModel::TABLE." WHERE swimlane_id=".self::TABLE.".id AND is_active='0'", 'nb_closed_tasks')
->eq('project_id', $project_id)
@@ -231,7 +231,7 @@ class SwimlaneModel extends Base
* @param string $description
* @return bool|int
*/
public function create($projectId, $name, $description = '')
public function create($projectId, $name, $description = '', $task_limit = 0)
{
if (! $this->projectModel->exists($projectId)) {
return 0;
@@ -243,6 +243,7 @@ class SwimlaneModel extends Base
'description' => $description,
'position' => $this->getLastPosition($projectId),
'is_active' => 1,
'task_limit' => $task_limit,
));
}