Skip to content

Commit

Permalink
refs #57 fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Mar 3, 2014
1 parent 727da1b commit 4de7581
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion plugins/Insights/DataTable/Filter/Insight.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ public function filter($table)
$oldValue = $row->getColumn($this->columnValueToRead);
$difference = $newValue - $oldValue;

$growthPercentage = '-100%';
if ($oldValue == 0 && $newValue == 0) {
$growthPercentage = '0%';
} else {
$growthPercentage = '-100%';
}

$this->addRow($table, $row, $growthPercentage, $newValue, $oldValue, $difference);
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/Insights/tests/FilterInsightTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function testShouldCalculateDifferenceAndGrowthPercentage()
array('label' => 'val9', 'growth_percent' => '-90.3%', 'growth_percent_numeric' => '-90.3', 'difference' => -65),
array('label' => 'val10', 'growth_percent' => '100%', 'growth_percent_numeric' => '100', 'difference' => 89),
array('label' => 'val102', 'growth_percent' => '-100%', 'growth_percent_numeric' => '-100', 'difference' => -29),
array('label' => 'val109', 'growth_percent' => '-100%', 'growth_percent_numeric' => '-100', 'difference' => 0),
array('label' => 'val109', 'growth_percent' => '0%', 'growth_percent_numeric' => '0', 'difference' => 0),
array('label' => 'val107', 'growth_percent' => '-100%', 'growth_percent_numeric' => '-100', 'difference' => -415),
);

Expand Down

0 comments on commit 4de7581

Please sign in to comment.