From 6c03925f23a91722471f33d3561543f4180f2b42 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 26 Sep 2015 20:41:14 -0400 Subject: Show number of tasks for each column across all swimlanes --- app/Model/Board.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/Model/Board.php') diff --git a/app/Model/Board.php b/app/Model/Board.php index b1032e90..d3d2703d 100644 --- a/app/Model/Board.php +++ b/app/Model/Board.php @@ -252,16 +252,22 @@ class Board extends Base $swimlanes[$i]['columns'] = $columns; $swimlanes[$i]['nb_columns'] = $nb_columns; $swimlanes[$i]['nb_tasks'] = 0; + $swimlanes[$i]['nb_swimlanes'] = $ilen; for ($j = 0; $j < $nb_columns; $j++) { $column_id = $columns[$j]['id']; $swimlane_id = $swimlanes[$i]['id']; + if (! isset($swimlanes[0]['columns'][$j]['nb_column_tasks'])) { + $swimlanes[0]['columns'][$j]['nb_column_tasks'] = 0; + } + $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id); $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[0]['columns'][$j]['nb_column_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks']; } } -- cgit v1.2.3 From 0b1da8d61c82d46ef54c3d7b699694baaeed83cf Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 26 Sep 2015 20:58:13 -0400 Subject: Show complexity sum across all swimlanes --- app/Model/Board.php | 2 ++ app/Template/board/table_column.php | 2 +- tests/units/Model/BoardTest.php | 38 ++++++++++++++++++++++++------------- 3 files changed, 28 insertions(+), 14 deletions(-) (limited to 'app/Model/Board.php') diff --git a/app/Model/Board.php b/app/Model/Board.php index d3d2703d..0e2cbaaa 100644 --- a/app/Model/Board.php +++ b/app/Model/Board.php @@ -261,6 +261,7 @@ class Board extends Base if (! isset($swimlanes[0]['columns'][$j]['nb_column_tasks'])) { $swimlanes[0]['columns'][$j]['nb_column_tasks'] = 0; + $swimlanes[0]['columns'][$j]['total_score'] = 0; } $swimlanes[$i]['columns'][$j]['tasks'] = $callback === null ? $this->taskFinder->getTasksByColumnAndSwimlane($project_id, $column_id, $swimlane_id) : $callback($project_id, $column_id, $swimlane_id); @@ -268,6 +269,7 @@ class Board extends Base $swimlanes[$i]['columns'][$j]['score'] = $this->getColumnSum($swimlanes[$i]['columns'][$j]['tasks'], 'score'); $swimlanes[$i]['nb_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks']; $swimlanes[0]['columns'][$j]['nb_column_tasks'] += $swimlanes[$i]['columns'][$j]['nb_tasks']; + $swimlanes[0]['columns'][$j]['total_score'] += $swimlanes[$i]['columns'][$j]['score']; } } diff --git a/app/Template/board/table_column.php b/app/Template/board/table_column.php index de7ca5e6..da8db52d 100644 --- a/app/Template/board/table_column.php +++ b/app/Template/board/table_column.php @@ -31,7 +31,7 @@ -   + diff --git a/tests/units/Model/BoardTest.php b/tests/units/Model/BoardTest.php index b527e983..106c6dc9 100644 --- a/tests/units/Model/BoardTest.php +++ b/tests/units/Model/BoardTest.php @@ -54,11 +54,15 @@ class BoardTest extends Base $board = $b->getBoard(1); $this->assertNotEmpty($board); $this->assertEquals(1, count($board)); - $this->assertEquals(5, count($board[0])); - $this->assertTrue(array_key_exists('name', $board[0])); - $this->assertTrue(array_key_exists('columns', $board[0])); - $this->assertTrue(array_key_exists('tasks', $board[0]['columns'][2])); - $this->assertTrue(array_key_exists('title', $board[0]['columns'][2])); + $this->assertEquals(6, count($board[0])); + $this->assertArrayHasKey('name', $board[0]); + $this->assertArrayHasKey('nb_tasks', $board[0]); + $this->assertArrayHasKey('columns', $board[0]); + $this->assertArrayHasKey('tasks', $board[0]['columns'][2]); + $this->assertArrayHasKey('nb_tasks', $board[0]['columns'][2]); + $this->assertArrayHasKey('title', $board[0]['columns'][2]); + $this->assertArrayHasKey('nb_column_tasks', $board[0]['columns'][0]); + $this->assertArrayHasKey('total_score', $board[0]['columns'][0]); } public function testGetBoardWithSwimlane() @@ -75,18 +79,26 @@ class BoardTest extends Base $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 1, 'column_id' => 3))); $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 1, 'column_id' => 2, 'swimlane_id' => 1))); $this->assertEquals(4, $tc->create(array('title' => 'Task #4', 'project_id' => 1, 'column_id' => 3))); - $this->assertEquals(5, $tc->create(array('title' => 'Task #5', 'project_id' => 1, 'column_id' => 4))); - $this->assertEquals(6, $tc->create(array('title' => 'Task #6', 'project_id' => 1, 'column_id' => 4, 'swimlane_id' => 1))); + $this->assertEquals(5, $tc->create(array('title' => 'Task #5', 'project_id' => 1, 'column_id' => 4, 'score' => 2))); + $this->assertEquals(6, $tc->create(array('title' => 'Task #6', 'project_id' => 1, 'column_id' => 4, 'score' => 3, 'swimlane_id' => 1))); $board = $b->getBoard(1); $this->assertNotEmpty($board); $this->assertEquals(2, count($board)); - $this->assertEquals(5, count($board[0])); - $this->assertTrue(array_key_exists('nb_tasks', $board[0])); - $this->assertTrue(array_key_exists('name', $board[0])); - $this->assertTrue(array_key_exists('columns', $board[0])); - $this->assertTrue(array_key_exists('tasks', $board[0]['columns'][2])); - $this->assertTrue(array_key_exists('title', $board[0]['columns'][2])); + $this->assertEquals(6, count($board[0])); + $this->assertArrayHasKey('name', $board[0]); + $this->assertArrayHasKey('nb_tasks', $board[0]); + $this->assertArrayHasKey('columns', $board[0]); + $this->assertArrayHasKey('tasks', $board[0]['columns'][2]); + $this->assertArrayHasKey('nb_tasks', $board[0]['columns'][2]); + $this->assertArrayHasKey('title', $board[0]['columns'][2]); + $this->assertArrayHasKey('nb_column_tasks', $board[0]['columns'][0]); + $this->assertArrayNotHasKey('nb_column_tasks', $board[1]['columns'][0]); + $this->assertArrayNotHasKey('total_score', $board[1]['columns'][0]); + $this->assertArrayHasKey('score', $board[0]['columns'][3]); + $this->assertArrayHasKey('total_score', $board[0]['columns'][3]); + $this->assertEquals(2, $board[0]['columns'][3]['score']); + $this->assertEquals(5, $board[0]['columns'][3]['total_score']); $task = $tf->getById(1); $this->assertEquals(1, $task['id']); -- cgit v1.2.3