Fix bug tasks don't show up on board/swimlanes
This commit is contained in:
@@ -239,15 +239,15 @@ class Board extends Base
|
||||
$columns = $this->getColumns($project_id);
|
||||
$nb_columns = count($columns);
|
||||
|
||||
foreach ($swimlanes as &$swimlane) {
|
||||
for ($i = 0, $ilen = count($swimlanes); $i < $ilen; $i++) {
|
||||
|
||||
foreach ($columns as &$column) {
|
||||
$column['tasks'] = $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $column['id'], $swimlane['id']);
|
||||
$column['nb_tasks'] = count($column['tasks']);
|
||||
$swimlanes[$i]['columns'] = $columns;
|
||||
$swimlanes[$i]['nb_columns'] = $nb_columns;
|
||||
|
||||
for ($j = 0; $j < $nb_columns; $j++) {
|
||||
$swimlanes[$i]['columns'][$j]['tasks'] = $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $columns[$j]['id'], $swimlanes[$i]['id']);
|
||||
$swimlanes[$i]['columns'][$j]['nb_tasks'] = count($swimlanes[$i]['columns'][$j]['tasks']);
|
||||
}
|
||||
|
||||
$swimlane['columns'] = $columns;
|
||||
$swimlane['nb_columns'] = $nb_columns;
|
||||
}
|
||||
|
||||
return $swimlanes;
|
||||
|
||||
@@ -51,9 +51,10 @@ class TaskCreation extends Base
|
||||
$values['color_id'] = $this->color->getDefaultColor();
|
||||
}
|
||||
|
||||
$values['swimlane_id'] = empty($values['swimlane_id']) ? 0 : $values['swimlane_id'];
|
||||
$values['date_creation'] = time();
|
||||
$values['date_modification'] = $values['date_creation'];
|
||||
$values['position'] = $this->taskFinder->countByColumnId($values['project_id'], $values['column_id']) + 1;
|
||||
$values['position'] = $this->taskFinder->countByColumnAndSwimlaneId($values['project_id'], $values['column_id'], $values['swimlane_id']) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -229,6 +229,26 @@ class TaskFinder extends Base
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of tasks for a given column and swimlane
|
||||
*
|
||||
* @access public
|
||||
* @param integer $project_id Project id
|
||||
* @param integer $column_id Column id
|
||||
* @param integer $swimlane_id Swimlane id
|
||||
* @return integer
|
||||
*/
|
||||
public function countByColumnAndSwimlaneId($project_id, $column_id, $swimlane_id)
|
||||
{
|
||||
return $this->db
|
||||
->table(Task::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->eq('column_id', $column_id)
|
||||
->eq('swimlane_id', $swimlane_id)
|
||||
->in('is_active', 1)
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the task exists
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user