Show closed tasks on the Gantt chart and fix rounding for task progress
This commit is contained in:
@@ -19,7 +19,7 @@ class Gantt extends Base
|
|||||||
{
|
{
|
||||||
$project = $this->getProject();
|
$project = $this->getProject();
|
||||||
$sorting = $this->request->getStringParam('sorting', 'board');
|
$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') {
|
if ($sorting === 'date') {
|
||||||
$filter->query->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation');
|
$filter->query->asc(TaskModel::TABLE.'.date_started')->asc(TaskModel::TABLE.'.date_creation');
|
||||||
|
|||||||
@@ -195,6 +195,6 @@ class Task extends Base
|
|||||||
$position++;
|
$position++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) ($position * 100) / count($columns);
|
return round(($position * 100) / count($columns), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
require_once __DIR__.'/Base.php';
|
require_once __DIR__.'/Base.php';
|
||||||
|
|
||||||
use Model\Task;
|
use Model\Task;
|
||||||
|
use Model\Board;
|
||||||
|
use Model\TaskStatus;
|
||||||
use Model\TaskPosition;
|
use Model\TaskPosition;
|
||||||
use Model\TaskCreation;
|
use Model\TaskCreation;
|
||||||
use Model\TaskFinder;
|
use Model\TaskFinder;
|
||||||
@@ -11,6 +13,33 @@ use Model\Swimlane;
|
|||||||
|
|
||||||
class TaskPositionTest extends Base
|
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()
|
public function testMoveTaskToWrongPosition()
|
||||||
{
|
{
|
||||||
$tp = new TaskPosition($this->container);
|
$tp = new TaskPosition($this->container);
|
||||||
|
|||||||
Reference in New Issue
Block a user