diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-06-12 08:23:51 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-06-16 12:11:03 +0400 |
commit | d8f110aca03ff8c73811a141631f12a7a1ddc16f (patch) | |
tree | 58ca855357d521bae098e882970a14c83874b742 /plugins/Goals/Archiver.php | |
parent | c17139710a43b55b5f48377e6281db6ae602957c (diff) |
More refactoring, moving SQL to classes and cleaning up logic so I can understand it (nearly there)
Diffstat (limited to 'plugins/Goals/Archiver.php')
-rw-r--r-- | plugins/Goals/Archiver.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/plugins/Goals/Archiver.php b/plugins/Goals/Archiver.php index 0a5a154f3b..1946594122 100644 --- a/plugins/Goals/Archiver.php +++ b/plugins/Goals/Archiver.php @@ -146,10 +146,11 @@ class Piwik_Goals_Archiver extends Piwik_PluginsArchiver $this->insertReports(self::DAYS_UNTIL_CONV_RECORD_NAME, $daysToConversions); // Stats for all goals + $nbConvertedVisits = $this->getProcessor()->getNumberOfVisitsConverted(); $metrics = array( - self::getRecordName('conversion_rate') => $this->getConversionRate($this->getProcessor()->getNumberOfVisitsConverted()), + self::getRecordName('conversion_rate') => $this->getConversionRate($nbConvertedVisits), self::getRecordName('nb_conversions') => $totalConversions, - self::getRecordName('nb_visits_converted') => $this->getProcessor()->getNumberOfVisitsConverted(), + self::getRecordName('nb_visits_converted') => $nbConvertedVisits, self::getRecordName('revenue') => $totalRevenue, ); $this->getProcessor()->insertNumericRecords($metrics); @@ -380,7 +381,7 @@ class Piwik_Goals_Archiver extends Piwik_PluginsArchiver foreach ($this->dimensionRecord as $recordName) { $dataTableToSum[] = self::getItemRecordNameAbandonedCart($recordName); } - $this->getProcessor()->archiveDataTable($dataTableToSum); + $this->getProcessor()->aggregateDataTableReports($dataTableToSum); } /* @@ -402,7 +403,7 @@ class Piwik_Goals_Archiver extends Piwik_PluginsArchiver $fieldsToSum[] = self::getRecordName($metricName, $goalId); } } - $records = $this->getProcessor()->archiveNumericValuesSum($fieldsToSum); + $records = $this->getProcessor()->archiveNumericValuesGeneral($fieldsToSum); // also recording conversion_rate for each goal foreach ($goalIdsToSum as $goalId) { @@ -411,13 +412,13 @@ class Piwik_Goals_Archiver extends Piwik_PluginsArchiver $this->getProcessor()->insertNumericRecord(self::getRecordName('conversion_rate', $goalId), $conversion_rate); // sum up the visits to conversion data table & the days to conversion data table - $this->getProcessor()->archiveDataTable(array( + $this->getProcessor()->aggregateDataTableReports(array( self::getRecordName(self::VISITS_UNTIL_RECORD_NAME, $goalId), self::getRecordName(self::DAYS_UNTIL_CONV_RECORD_NAME, $goalId))); } // sum up goal overview reports - $this->getProcessor()->archiveDataTable(array( + $this->getProcessor()->aggregateDataTableReports(array( self::getRecordName(self::VISITS_UNTIL_RECORD_NAME), self::getRecordName(self::DAYS_UNTIL_CONV_RECORD_NAME))); } |