summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Controller/Gantt.php2
-rw-r--r--app/Model/Task.php2
-rw-r--r--tests/units/TaskPositionTest.php29
3 files changed, 31 insertions, 2 deletions
diff --git a/app/Controller/Gantt.php b/app/Controller/Gantt.php
index 6f3fb5c7..f450bca3 100644
--- a/app/Controller/Gantt.php
+++ b/app/Controller/Gantt.php
@@ -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');
diff --git a/app/Model/Task.php b/app/Model/Task.php
index ae8fc7a8..a1bbca93 100644
--- a/app/Model/Task.php
+++ b/app/Model/Task.php
@@ -195,6 +195,6 @@ class Task extends Base
$position++;
}
- return (int) ($position * 100) / count($columns);
+ return round(($position * 100) / count($columns), 1);
}
}
diff --git a/tests/units/TaskPositionTest.php b/tests/units/TaskPositionTest.php
index f3be325b..83436683 100644
--- a/tests/units/TaskPositionTest.php
+++ b/tests/units/TaskPositionTest.php
@@ -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);