From 9581f1b3519fa5c4936aaa9b788e5346b793d12a Mon Sep 17 00:00:00 2001 From: Thomas Steur <thomas.steur@googlemail.com> Date: Thu, 12 Jun 2014 01:07:49 +0200 Subject: [PATCH] fixed processed metrics --- core/Plugin/Report.php | 6 ++++-- plugins/API/ProcessedReport.php | 3 +++ plugins/Actions/Reports/Base.php | 1 + plugins/Events/Reports/Base.php | 1 + plugins/MultiSites/Reports/GetAll.php | 1 + plugins/MultiSites/Reports/GetOne.php | 1 + plugins/VisitFrequency/Reports/Get.php | 1 + .../Reports/GetNumberOfVisitsByDaysSinceLast.php | 1 + .../Reports/GetNumberOfVisitsByVisitCount.php | 1 + .../VisitorInterest/Reports/GetNumberOfVisitsPerPage.php | 1 + .../Reports/GetNumberOfVisitsPerVisitDuration.php | 1 + plugins/VisitsSummary/Reports/Get.php | 1 + 12 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php index 260c163977..f8c19bd159 100644 --- a/core/Plugin/Report.php +++ b/core/Plugin/Report.php @@ -26,7 +26,7 @@ class Report protected $widgetTitle; protected $widgetParams = array(); protected $menuTitle; - protected $processedMetrics = false; + protected $processedMetrics = array(); protected $metrics = array(); protected $constantRowsCount = null; protected $isSubtableReport = null; @@ -49,6 +49,8 @@ class Report $parts = explode('\\', $classname); $this->module = $parts[2]; $this->action = lcfirst($parts[4]); + $this->processedMetrics = Metrics::getDefaultProcessedMetrics(); + $this->metrics = array_keys(Metrics::getDefaultMetrics()); $this->init(); } @@ -121,7 +123,7 @@ class Report if (!empty($translations[$metric])) { $metrics[$metric] = $translations[$metric]; } else { - $metrics[$metric] = 'To be defined'; + $metrics[] = $metric; } } diff --git a/plugins/API/ProcessedReport.php b/plugins/API/ProcessedReport.php index c178f9f8e6..33640f0771 100644 --- a/plugins/API/ProcessedReport.php +++ b/plugins/API/ProcessedReport.php @@ -205,9 +205,11 @@ class ProcessedReport Piwik::postEvent('API.getReportMetadata', array(&$availableReports, $parameters)); foreach ($availableReports as &$availableReport) { + // can be removed once we remove hook API.getReportMetadata if (!isset($availableReport['metrics'])) { $availableReport['metrics'] = Metrics::getDefaultMetrics(); } + // can be removed once we remove hook API.getReportMetadata if (!isset($availableReport['processedMetrics'])) { $availableReport['processedMetrics'] = Metrics::getDefaultProcessedMetrics(); } @@ -217,6 +219,7 @@ class ProcessedReport unset($availableReport['metricsDocumentation']); } else if (!isset($availableReport['metricsDocumentation'])) { // set metric documentation to default if it's not set + // can be removed once we remove hook API.getReportMetadata $availableReport['metricsDocumentation'] = Metrics::getDefaultMetricsDocumentation(); } } diff --git a/plugins/Actions/Reports/Base.php b/plugins/Actions/Reports/Base.php index c94cb33503..c931663c3a 100644 --- a/plugins/Actions/Reports/Base.php +++ b/plugins/Actions/Reports/Base.php @@ -21,6 +21,7 @@ abstract class Base extends \Piwik\Plugin\Report protected function init() { $this->category = 'General_Actions'; + $this->processedMetrics = false; } protected function addBaseDisplayProperties(ViewDataTable $view) diff --git a/plugins/Events/Reports/Base.php b/plugins/Events/Reports/Base.php index 2a559c5504..f119db5326 100644 --- a/plugins/Events/Reports/Base.php +++ b/plugins/Events/Reports/Base.php @@ -18,6 +18,7 @@ abstract class Base extends \Piwik\Plugin\Report protected function init() { $this->category = 'Events_Events'; + $this->processedMetrics = false; $this->widgetParams = array( 'secondaryDimension' => API::getInstance()->getDefaultSecondaryDimension($this->action) diff --git a/plugins/MultiSites/Reports/GetAll.php b/plugins/MultiSites/Reports/GetAll.php index 8fc00cece3..cf10b0f159 100644 --- a/plugins/MultiSites/Reports/GetAll.php +++ b/plugins/MultiSites/Reports/GetAll.php @@ -19,6 +19,7 @@ class GetAll extends Base $this->dimension = new Website(); $this->name = Piwik::translate('General_AllWebsitesDashboard'); $this->documentation = ''; // TODO + $this->processedMetrics = false; $this->constantRowsCount = false; $this->order = 4; } diff --git a/plugins/MultiSites/Reports/GetOne.php b/plugins/MultiSites/Reports/GetOne.php index 65727346b5..715e3007c9 100644 --- a/plugins/MultiSites/Reports/GetOne.php +++ b/plugins/MultiSites/Reports/GetOne.php @@ -20,6 +20,7 @@ class GetOne extends Base $this->name = Piwik::translate('General_SingleWebsitesDashboard'); $this->documentation = ''; // TODO $this->constantRowsCount = false; + $this->processedMetrics = false; $this->order = 5; } diff --git a/plugins/VisitFrequency/Reports/Get.php b/plugins/VisitFrequency/Reports/Get.php index 862e3d26b0..624d8440e1 100644 --- a/plugins/VisitFrequency/Reports/Get.php +++ b/plugins/VisitFrequency/Reports/Get.php @@ -19,6 +19,7 @@ class Get extends \Piwik\Plugin\Report $this->name = Piwik::translate('VisitFrequency_ColumnReturningVisits'); $this->documentation = ''; // TODO $this->metrics = array('nb_visits_returning', 'nb_actions_returning', 'avg_time_on_site_returning', 'bounce_rate_returning', 'nb_actions_per_visit_returning', 'nb_uniq_visitors_returning'); + $this->processedMetrics = false; $this->order = 40; } } diff --git a/plugins/VisitorInterest/Reports/GetNumberOfVisitsByDaysSinceLast.php b/plugins/VisitorInterest/Reports/GetNumberOfVisitsByDaysSinceLast.php index 4e4fc9a28c..cd5ca482df 100644 --- a/plugins/VisitorInterest/Reports/GetNumberOfVisitsByDaysSinceLast.php +++ b/plugins/VisitorInterest/Reports/GetNumberOfVisitsByDaysSinceLast.php @@ -21,6 +21,7 @@ class GetNumberOfVisitsByDaysSinceLast extends Base $this->name = Piwik::translate('VisitorInterest_VisitsByDaysSinceLast'); $this->documentation = Piwik::translate('VisitorInterest_WidgetVisitsByDaysSinceLastDocumentation'); $this->metrics = array('nb_visits'); + $this->processedMetrics = false; $this->constantRowsCount = true; $this->order = 30; $this->widgetTitle = 'VisitorInterest_WidgetVisitsByDaysSinceLast'; diff --git a/plugins/VisitorInterest/Reports/GetNumberOfVisitsByVisitCount.php b/plugins/VisitorInterest/Reports/GetNumberOfVisitsByVisitCount.php index 80a5ef0e7b..c3a12f9a46 100644 --- a/plugins/VisitorInterest/Reports/GetNumberOfVisitsByVisitCount.php +++ b/plugins/VisitorInterest/Reports/GetNumberOfVisitsByVisitCount.php @@ -23,6 +23,7 @@ class GetNumberOfVisitsByVisitCount extends Base $this->documentation = Piwik::translate('VisitorInterest_WidgetVisitsByNumDocumentation') . '<br />' . Piwik::translate('General_ChangeTagCloudView'); $this->metrics = array('nb_visits', 'nb_visits_percentage'); + $this->processedMetrics = false; $this->constantRowsCount = true; $this->order = 25; $this->widgetTitle = 'VisitorInterest_visitsByVisitCount'; diff --git a/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerPage.php b/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerPage.php index 351c3b35e7..c805195e93 100644 --- a/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerPage.php +++ b/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerPage.php @@ -24,6 +24,7 @@ class GetNumberOfVisitsPerPage extends Base $this->documentation = Piwik::translate('VisitorInterest_WidgetPagesDocumentation') . '<br />' . Piwik::translate('General_ChangeTagCloudView'); $this->metrics = array('nb_visits'); + $this->processedMetrics = false; $this->constantRowsCount = true; $this->order = 20; $this->widgetTitle = 'VisitorInterest_WidgetPages'; diff --git a/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerVisitDuration.php b/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerVisitDuration.php index 9c2363ba29..7b79dd92ed 100644 --- a/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerVisitDuration.php +++ b/plugins/VisitorInterest/Reports/GetNumberOfVisitsPerVisitDuration.php @@ -24,6 +24,7 @@ class GetNumberOfVisitsPerVisitDuration extends Base $this->documentation = Piwik::translate('VisitorInterest_WidgetLengthsDocumentation') . '<br />' . Piwik::translate('General_ChangeTagCloudView'); $this->metrics = array('nb_visits'); + $this->processedMetrics = false; $this->constantRowsCount = true; $this->order = 15; $this->widgetTitle = 'VisitorInterest_WidgetLengths'; diff --git a/plugins/VisitsSummary/Reports/Get.php b/plugins/VisitsSummary/Reports/Get.php index 4dbb1e5606..0023072bf3 100644 --- a/plugins/VisitsSummary/Reports/Get.php +++ b/plugins/VisitsSummary/Reports/Get.php @@ -18,6 +18,7 @@ class Get extends \Piwik\Plugin\Report $this->category = 'VisitsSummary_VisitsSummary'; $this->name = Piwik::translate('VisitsSummary_VisitsSummary'); $this->documentation = ''; // TODO + $this->processedMetrics = false; $this->metrics = array( 'nb_uniq_visitors', 'nb_visits', -- GitLab