Display the sum of task complexity in the column
This commit is contained in:
@@ -225,6 +225,7 @@ class Board extends Base
|
|||||||
for ($j = 0; $j < $nb_columns; $j++) {
|
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]['tasks'] = $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $columns[$j]['id'], $swimlanes[$i]['id']);
|
||||||
$swimlanes[$i]['columns'][$j]['nb_tasks'] = count($swimlanes[$i]['columns'][$j]['tasks']);
|
$swimlanes[$i]['columns'][$j]['nb_tasks'] = count($swimlanes[$i]['columns'][$j]['tasks']);
|
||||||
|
$swimlanes[$i]['columns'][$j]['score'] = $this->getColumnSum($swimlanes[$i]['columns'][$j]['tasks'], 'score');
|
||||||
$swimlanes[$i]['nb_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks'];
|
$swimlanes[$i]['nb_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,6 +233,25 @@ class Board extends Base
|
|||||||
return $swimlanes;
|
return $swimlanes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate the sum of the defined field for a list of tasks
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param array $tasks
|
||||||
|
* @param string $field
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getColumnSum(array &$tasks, $field)
|
||||||
|
{
|
||||||
|
$sum = 0;
|
||||||
|
|
||||||
|
foreach ($tasks as $task) {
|
||||||
|
$sum += $task['score'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sum;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the total of tasks per column
|
* Get the total of tasks per column
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -33,6 +33,12 @@
|
|||||||
</span>
|
</span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
|
<?php if (! empty($column['score'])): ?>
|
||||||
|
<span class="column-score pull-right" title="<?= t('Score') ?>">
|
||||||
|
<?= $column['score'] ?>
|
||||||
|
</span>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
<?php if ($column['task_limit']): ?>
|
<?php if ($column['task_limit']): ?>
|
||||||
<span title="<?= t('Task limit') ?>" class="task-limit">
|
<span title="<?= t('Task limit') ?>" class="task-limit">
|
||||||
(<span id="task-number-column-<?= $column['id'] ?>"><?= $column['nb_tasks'] ?></span>/<?= $this->e($column['task_limit']) ?>)
|
(<span id="task-number-column-<?= $column['id'] ?>"><?= $column['nb_tasks'] ?></span>/<?= $this->e($column['task_limit']) ?>)
|
||||||
|
|||||||
Reference in New Issue
Block a user