diff options
author | Stefan Giehl <stefan@matomo.org> | 2020-12-10 04:16:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-10 04:16:13 +0300 |
commit | 848d1a258b085cad5b7725e630b1303f4c8e3a21 (patch) | |
tree | e805e324677a9d0686124bcf4100ab7ece6f3534 /plugins | |
parent | 5706eabad6d1a6495ef12937f02cde0c8cda80cc (diff) |
Improvements on prepending a plus sign to evolutions (#16923)
* fix prepending a plus sign to evolutions
* updates expected test files
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/API/Filter/DataComparisonFilter.php | 7 | ||||
-rw-r--r-- | plugins/API/RowEvolution.php | 4 |
2 files changed, 3 insertions, 8 deletions
diff --git a/plugins/API/Filter/DataComparisonFilter.php b/plugins/API/Filter/DataComparisonFilter.php index 03bc5e6b1b..17bec4430d 100644 --- a/plugins/API/Filter/DataComparisonFilter.php +++ b/plugins/API/Filter/DataComparisonFilter.php @@ -521,12 +521,7 @@ class DataComparisonFilter $valueToCompare = $fromRow ? $fromRow->getColumn($columnName) : 0; $valueToCompare = $valueToCompare ?: 0; - $change = DataTable\Filter\CalculateEvolutionFilter::calculate($value, $valueToCompare, $precision = 1, $appendPercent = false); - - if ($change >= 0) { - $change = '+' . $change; - } - $change .= '%'; + $change = DataTable\Filter\CalculateEvolutionFilter::calculate($value, $valueToCompare, $precision = 1, true, true); return $change; } diff --git a/plugins/API/RowEvolution.php b/plugins/API/RowEvolution.php index da44b19f6b..fe046e9ffb 100644 --- a/plugins/API/RowEvolution.php +++ b/plugins/API/RowEvolution.php @@ -411,8 +411,8 @@ class RowEvolution continue; } - $change = CalculateEvolutionFilter::calculate($last, $first, $quotientPrecision = 0); - $change = CalculateEvolutionFilter::prependPlusSignToNumber($change); + $change = CalculateEvolutionFilter::calculate($last, $first, $quotientPrecision = 0, true, true); + $metricsResult[$metric]['change'] = $change; } |