Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2018-05-01 02:56:36 +0300
committerBenaka <diosmosis@users.noreply.github.com>2018-05-01 02:56:36 +0300
commit38c9a6dbfc722b8940df2420a0c5df35c3b589c8 (patch)
treea4a7f90906ad9201ce6e6451df059259587df894 /core/Plugin/ComputedMetric.php
parentd73ba46f2d903abac5cd322affca36396d8bc046 (diff)
Use a higher precision for rates to show more accurate percentage values (#12775)
Currently, we round to two decimals. This means when calculating the percentage (`x 100`) we show eg only 1% or 5% in custom reports. However, for conversion rates etc we should show more accurate values and therefore need to use a higher precision.
Diffstat (limited to 'core/Plugin/ComputedMetric.php')
-rw-r--r--core/Plugin/ComputedMetric.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/Plugin/ComputedMetric.php b/core/Plugin/ComputedMetric.php
index 7825fedde3..5d0e06bc36 100644
--- a/core/Plugin/ComputedMetric.php
+++ b/core/Plugin/ComputedMetric.php
@@ -121,7 +121,12 @@ class ComputedMetric extends ProcessedMetric
$metric1 = $this->getMetric($row, $this->metric1);
$metric2 = $this->getMetric($row, $this->metric2);
- return Piwik::getQuotientSafe($metric1, $metric2, $precision = 2);
+ $precision = 2;
+ if ($this->aggregation === self::AGGREGATION_RATE) {
+ $precision = 3;
+ }
+
+ return Piwik::getQuotientSafe($metric1, $metric2, $precision);
}
private function getDetectedType()