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:
authorStefan Giehl <stefan@matomo.org>2022-05-05 04:56:25 +0300
committerGitHub <noreply@github.com>2022-05-05 04:56:25 +0300
commit4c7a49e37f7f03486efbb372dd5a720439d68ff6 (patch)
treec701aade16537002e71a08b5ca4c52cab2ead99c /plugins/CoreHome
parent41c1872908931486bdc544514ddbb4e9e4d1cb59 (diff)
Avoid calling Metrics::isLowerValueBetter too often for Evolution metrics (#19172)
Diffstat (limited to 'plugins/CoreHome')
-rw-r--r--plugins/CoreHome/Columns/Metrics/EvolutionMetric.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php b/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php
index d400396a96..d993caf914 100644
--- a/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php
+++ b/plugins/CoreHome/Columns/Metrics/EvolutionMetric.php
@@ -60,6 +60,8 @@ class EvolutionMetric extends ProcessedMetric
*/
private $currentData;
+ private $isLowerBetter = false;
+
/**
* The list of labels leading to the current subtable being processed. Used to get the proper subtable in
* $pastData.
@@ -83,6 +85,7 @@ class EvolutionMetric extends ProcessedMetric
?DataTable $currentData = null)
{
$this->wrapped = $wrapped;
+ $this->isLowerBetter = Metrics::isLowerValueBetter($this->wrapped);
$this->pastData = $pastData;
$this->currentData = $currentData;
@@ -119,8 +122,7 @@ class EvolutionMetric extends ProcessedMetric
public function getTrendValue($computedValue = 0)
{
- $isLowerBetter = Metrics::isLowerValueBetter($this->wrapped);
- if ($isLowerBetter) {
+ if ($this->isLowerBetter) {
return ($computedValue < 0 ? 1 : ($computedValue > 0 ? -1 : 0));
}