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>2020-08-17 23:00:30 +0300
committerGitHub <noreply@github.com>2020-08-17 23:00:30 +0300
commit62a09200ad7f103c6a55157a25bbfad3c67bfa4a (patch)
treee1e7eb9095023a99edcb1c91fb9beb59e0d21826 /core/Plugin/Report.php
parent3e1234a887f56a1cf853e29ba89370b234af5127 (diff)
Number formatting may be wrong when eg German language is used (#16295)
* Expose new method getType * don't format archived numbers
Diffstat (limited to 'core/Plugin/Report.php')
-rw-r--r--core/Plugin/Report.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php
index 740eed1853..2a9446272b 100644
--- a/core/Plugin/Report.php
+++ b/core/Plugin/Report.php
@@ -972,7 +972,24 @@ class Report
$result = array();
foreach ($processedMetrics as $processedMetric) {
- if ($processedMetric instanceof ProcessedMetric || $processedMetric instanceof ArchivedMetric) { // instanceof check for backwards compatibility
+ if ($processedMetric instanceof ProcessedMetric) { // instanceof check for backwards compatibility
+ $result[$processedMetric->getName()] = $processedMetric;
+ } elseif ($processedMetric instanceof ArchivedMetric
+ && $processedMetric->getType() !== Dimension::TYPE_NUMBER
+ && $processedMetric->getType() !== Dimension::TYPE_FLOAT
+ && $processedMetric->getType() !== Dimension::TYPE_BOOL
+ && $processedMetric->getType() !== Dimension::TYPE_ENUM
+ ) {
+ // we do not format regular numbers from regular archived metrics here because when they are rendered
+ // in a visualisation (eg HtmlTable) they would be formatted again in the regular number filter.
+ // These metrics aren't "processed metrics". Eventually could maybe format them when "&format_metrics=all"
+ // is used but may not be needed. It caused a problem when eg language==de. Then eg 555444 would be formatted
+ // to "555.444" (which is the German version of the English "555,444") in the data table post processor
+ // when formatting metrics. Then when rendering the visualisation it would check "is_numeric()" which is
+ // true for German formatting but false for English formatting. Meaning for English formatting the number
+ // would be correctly printed as is but for the German formatting it would format it again and it would think
+ // it would be assumed the dot is a decimal separator and therefore the number be formatted to "555,44" which
+ // is the English version of "555.44" (because we only show 2 fractions).
$result[$processedMetric->getName()] = $processedMetric;
}
}