diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-06-18 08:14:49 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-06-18 08:14:49 +0400 |
commit | 621db6a16a37374aed623f75ea8cdabdf2b8e8d0 (patch) | |
tree | 6cc0365cf90f2d82dcdc5321043fe99aeabd8141 /core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php | |
parent | d8ac3977a27b41b1a87caceb2f9766a6305391cf (diff) |
Adding new Metrics class that knows about all metrics. Moving from Piwik_Archive class.
Also moved some other const to Piwik class.
Diffstat (limited to 'core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php')
-rw-r--r-- | core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php index 2d9e6cf02a..167eea9a96 100644 --- a/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php +++ b/core/DataTable/Filter/AddColumnsProcessedMetricsGoal.php @@ -50,7 +50,7 @@ class Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal extends Piwik_DataTa public function __construct($table, $enable = true, $processOnlyIdGoal) { $this->processOnlyIdGoal = $processOnlyIdGoal; - $this->isEcommerce = $this->processOnlyIdGoal == Piwik_Archive::LABEL_ECOMMERCE_ORDER || $this->processOnlyIdGoal == Piwik_Archive::LABEL_ECOMMERCE_CART; + $this->isEcommerce = $this->processOnlyIdGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER || $this->processOnlyIdGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART; parent::__construct($table); // Ensure that all rows with no visit but conversions will be displayed $this->deleteRowsWithNoVisit = false; @@ -72,24 +72,24 @@ class Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal extends Piwik_DataTa $newColumns = array(); // visits could be undefined when there is a conversion but no visit - $nbVisits = (int)$this->getColumn($row, Piwik_Archive::INDEX_NB_VISITS); - $conversions = (int)$this->getColumn($row, Piwik_Archive::INDEX_NB_CONVERSIONS); - $goals = $this->getColumn($currentColumns, Piwik_Archive::INDEX_GOALS); + $nbVisits = (int)$this->getColumn($row, Piwik_Metrics::INDEX_NB_VISITS); + $conversions = (int)$this->getColumn($row, Piwik_Metrics::INDEX_NB_CONVERSIONS); + $goals = $this->getColumn($currentColumns, Piwik_Metrics::INDEX_GOALS); if ($goals) { $revenue = 0; foreach ($goals as $goalId => $columnValue) { - if ($goalId == Piwik_Archive::LABEL_ECOMMERCE_CART) { + if ($goalId == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART) { continue; } if ($goalId >= Piwik_Tracker_GoalManager::IDGOAL_ORDER - || $goalId == Piwik_Archive::LABEL_ECOMMERCE_ORDER + || $goalId == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER ) { - $revenue += (int)$this->getColumn($columnValue, Piwik_Archive::INDEX_GOAL_REVENUE, Piwik_Archive::$mappingFromIdToNameGoal); + $revenue += (int)$this->getColumn($columnValue, Piwik_Metrics::INDEX_GOAL_REVENUE, Piwik_Metrics::$mappingFromIdToNameGoal); } } if ($revenue == 0) { - $revenue = (int)$this->getColumn($currentColumns, Piwik_Archive::INDEX_REVENUE); + $revenue = (int)$this->getColumn($currentColumns, Piwik_Metrics::INDEX_REVENUE); } if (!isset($currentColumns['revenue_per_visit'])) { // If no visit for this metric, but some conversions, we still want to display some kind of "revenue per visit" @@ -118,7 +118,7 @@ class Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal extends Piwik_DataTa ) { continue; } - $conversions = (int)$this->getColumn($columnValue, Piwik_Archive::INDEX_GOAL_NB_CONVERSIONS, Piwik_Archive::$mappingFromIdToNameGoal); + $conversions = (int)$this->getColumn($columnValue, Piwik_Metrics::INDEX_GOAL_NB_CONVERSIONS, Piwik_Metrics::$mappingFromIdToNameGoal); // Goal Conversion rate $name = 'goal_' . $goalId . '_conversion_rate'; @@ -144,7 +144,7 @@ class Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal extends Piwik_DataTa // Goal Revenue per visit $name = 'goal_' . $goalId . '_revenue_per_visit'; // See comment above for $revenuePerVisit - $goalRevenue = (float)$this->getColumn($columnValue, Piwik_Archive::INDEX_GOAL_REVENUE, Piwik_Archive::$mappingFromIdToNameGoal); + $goalRevenue = (float)$this->getColumn($columnValue, Piwik_Metrics::INDEX_GOAL_REVENUE, Piwik_Metrics::$mappingFromIdToNameGoal); $revenuePerVisit = round($goalRevenue / ($nbVisits == 0 ? $conversions : $nbVisits), $roundingPrecision); $newColumns[$name] = $revenuePerVisit; $expectedColumns[$name] = true; @@ -163,7 +163,7 @@ class Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal extends Piwik_DataTa // Items qty $name = 'goal_' . $goalId . '_items'; - $newColumns[$name] = $this->getColumn($columnValue, Piwik_Archive::INDEX_GOAL_ECOMMERCE_ITEMS, Piwik_Archive::$mappingFromIdToNameGoal); + $newColumns[$name] = $this->getColumn($columnValue, Piwik_Metrics::INDEX_GOAL_ECOMMERCE_ITEMS, Piwik_Metrics::$mappingFromIdToNameGoal); $expectedColumns[$name] = true; } } |