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:
authorBen Burgess <88810029+bx80@users.noreply.github.com>2022-05-31 14:55:13 +0300
committerGitHub <noreply@github.com>2022-05-31 14:55:13 +0300
commit9a7dd7d9fdce120c80dc82ea77019e8c1a489af0 (patch)
treeeecc765c193fe6a6a0a7a7eeadb4dc6e676c56c6 /plugins
parent5ee8fb2829302b9d84549faacc2137039f21bc75 (diff)
Fix for missing formatting of conversion rate on goals reports (#19295)
* Fix missing formatting of conversion_rate on goals reports * try to solve problem with API.get report * updates expected test files Co-authored-by: sgiehl <stefan@matomo.org>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CoreVisualizations/Visualizations/Sparklines.php5
-rw-r--r--plugins/Goals/Reports/Get.php12
-rw-r--r--plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal.png4
-rw-r--r--plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal_updated.png4
4 files changed, 20 insertions, 5 deletions
diff --git a/plugins/CoreVisualizations/Visualizations/Sparklines.php b/plugins/CoreVisualizations/Visualizations/Sparklines.php
index fac81dd033..402d92d322 100644
--- a/plugins/CoreVisualizations/Visualizations/Sparklines.php
+++ b/plugins/CoreVisualizations/Visualizations/Sparklines.php
@@ -252,7 +252,10 @@ class Sparklines extends ViewDataTable
[$compareValues, $compareDescriptions, $evolutions] = $this->getValuesAndDescriptions($compareRow, $columnToUse, '_change', '_trend');
foreach ($compareValues as $i => $value) {
- if ($columnMetrics[$columnToUse[$i]]) {
+ if (!isset($column[$i])) {
+ continue;
+ }
+ if (isset($columnMetrics[$column[$i]]) && $columnMetrics[$column[$i]]) {
$value = $columnMetrics[$columnToUse[$i]]->format($value, $metricFormatter);
} elseif (strpos($columnToUse[$i], 'revenue') !== false && $idSite > 0) {
$value = $metricFormatter->getPrettyMoney($value, $idSite);
diff --git a/plugins/Goals/Reports/Get.php b/plugins/Goals/Reports/Get.php
index ba5f9850d9..5a3a341163 100644
--- a/plugins/Goals/Reports/Get.php
+++ b/plugins/Goals/Reports/Get.php
@@ -23,6 +23,7 @@ use Piwik\Piwik;
use Piwik\Period\Factory as PeriodFactory;
use Piwik\Plugin;
use Piwik\Plugin\ViewDataTable;
+use Piwik\Plugins\CoreHome\Columns\Metrics\ConversionRate;
use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Evolution;
use Piwik\Plugins\CoreVisualizations\Visualizations\Sparklines;
use Piwik\Plugins\Goals\Goals;
@@ -138,6 +139,17 @@ class Get extends Base
'revenue' => Piwik::translate('Goals_OverallRevenue'),
]);
+ // Adding conversion rate as extra processed metrics ensures it will be formatted
+ $view->config->filters[] = function (DataTable $t) {
+ $extraProcessedMetrics = $t->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME);
+
+ if (empty($extraProcessedMetrics)) {
+ $extraProcessedMetrics = [];
+ }
+ $extraProcessedMetrics[] = new ConversionRate();
+ $t->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, $extraProcessedMetrics);
+ };
+
$allowMultiple = Common::getRequestVar('allow_multiple', 0, 'int');
if ($allowMultiple) {
diff --git a/plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal.png b/plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal.png
index a3288fe939..1c2f6984a5 100644
--- a/plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal.png
+++ b/plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:95c851c648cf543352e78f63a6e80b425dca08d7e1c3715baf4e0c425d4b74fb
-size 201716
+oid sha256:69e4b5390196b8623d414a5773a7232c61f446ff7405f4e7f2289a3dedf7f82e
+size 203340
diff --git a/plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal_updated.png b/plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal_updated.png
index d4787789b0..5a8a923363 100644
--- a/plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal_updated.png
+++ b/plugins/Goals/tests/UI/expected-screenshots/GoalsPages_individual_goal_updated.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:2cf473eef5935fecea595337e53099e721c8090dbdbd99ebf1907d1b22aeaf7d
-size 206484
+oid sha256:c9b14efd094a0f2668019dc7e49c8400b9ef997d8990187aad9124145ead5bb9
+size 208155