Show closed tasks on the Gantt chart and fix rounding for task progress

This commit is contained in:
Frederic Guillot 2015-08-20 21:26:42 -04:00
parent 5b888a2345
commit 1484b1c39c
3 changed files with 31 additions and 2 deletions

View File

@ -19,7 +19,7 @@ class Gantt extends Base
{
$project = $this->getProject();
$sorting = $this->request->getStringParam('sorting', 'board');
$filter = $this->taskFilter->gantt()->filterByProject($project['id'])->filterByStatus(TaskModel::STATUS_OPEN);
$filter = $this->taskFilter->gantt()->filterByProject($project['id']);
if ($sorting === 'date') {
$filter->query->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation');

View File

@ -195,6 +195,6 @@ class Task extends Base
$position++;
}
return (int) ($position * 100) / count($columns);
return round(($position * 100) / count($columns), 1);
}
}

View File

@ -3,6 +3,8 @@
require_once __DIR__.'/Base.php';
use Model\Task;
use Model\Board;
use Model\TaskStatus;
use Model\TaskPosition;
use Model\TaskCreation;
use Model\TaskFinder;
@ -11,6 +13,33 @@ use Model\Swimlane;
class TaskPositionTest extends Base
{
public function testGetTaskProgression()
{
$t = new Task($this->container);
$ts = new TaskStatus($this->container);
$tp = new TaskPosition($this->container);
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
$p = new Project($this->container);
$b = new Board($this->container);
$this->assertEquals(1, $p->create(array('name' => 'Project #1')));
$this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'column_id' => 1)));
$this->assertEquals(0, $t->getProgress($tf->getById(1), $b->getColumnsList(1)));
$this->assertTrue($tp->movePosition(1, 1, 2, 1));
$this->assertEquals(25, $t->getProgress($tf->getById(1), $b->getColumnsList(1)));
$this->assertTrue($tp->movePosition(1, 1, 3, 1));
$this->assertEquals(50, $t->getProgress($tf->getById(1), $b->getColumnsList(1)));
$this->assertTrue($tp->movePosition(1, 1, 4, 1));
$this->assertEquals(75, $t->getProgress($tf->getById(1), $b->getColumnsList(1)));
$this->assertTrue($ts->close(1));
$this->assertEquals(100, $t->getProgress($tf->getById(1), $b->getColumnsList(1)));
}
public function testMoveTaskToWrongPosition()
{
$tp = new TaskPosition($this->container);