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:
authorBenaka Moorthi <benaka.moorthi@gmail.com>2013-06-19 09:45:55 +0400
committerBenaka Moorthi <benaka.moorthi@gmail.com>2013-06-19 09:46:11 +0400
commitf9af4b22914721e71f9f430ffa00be8a2d156158 (patch)
treef17dee0b6b47b1719d5f2cf401b20f70511aa953 /plugins/VisitTime
parentd90be87866c12e2a4a704eb98c5b63b457124baa (diff)
Fixing regressions in recent refactorings, fixing regression in Archive.php refactoring and fixing bug in integration testing code which sets 'date' query param.
Diffstat (limited to 'plugins/VisitTime')
-rw-r--r--plugins/VisitTime/API.php32
1 files changed, 12 insertions, 20 deletions
diff --git a/plugins/VisitTime/API.php b/plugins/VisitTime/API.php
index 7f794bce82..2f4aaee06b 100644
--- a/plugins/VisitTime/API.php
+++ b/plugins/VisitTime/API.php
@@ -68,32 +68,24 @@ class Piwik_VisitTime_API
// metrics to query
$metrics = Piwik_Metrics::getVisitsMetricNames();
unset($metrics[Piwik_Metrics::INDEX_MAX_ACTIONS]);
-
- try {
- // get metric data for every day within the supplied period
- $oPeriod = Piwik_Period::makePeriodFromQueryParams(Piwik_Site::getTimezoneFor($idSite), $period, $date);
- $dateRange = $oPeriod->getDateStart()->toString() . ',' . $oPeriod->getDateEnd()->toString();
- $archive = Piwik_Archive::build($idSite, 'day', $dateRange, $segment);
- } catch(Exception $e) {
- throw new Exception("getByDayOfWeek not working yet");
+
+ // disabled for multiple dates
+ if (Piwik_Period::isMultiplePeriod($date, $period)) {
+ throw new Exception("VisitTime.getByDayOfWeek does not support multiple dates.");
}
- // disabled for multiple sites/dates
- if ( count( $archive->getParams()->getIdSites() ) > 1) {
- throw new Exception("VisitTime.getByDayOfWeek does not support multiple sites.");
- }
+ // get metric data for every day within the supplied period
+ $oPeriod = Piwik_Period::makePeriodFromQueryParams(Piwik_Site::getTimezoneFor($idSite), $period, $date);
+ $dateRange = $oPeriod->getDateStart()->toString() . ',' . $oPeriod->getDateEnd()->toString();
+ $archive = Piwik_Archive::build($idSite, 'day', $dateRange, $segment);
- $periods = $archive->getParams()->getPeriods();
- if ( count ($periods) > 1
- && !($periods[0] instanceof Piwik_Period_Day)) {
- throw new Exception("VisitTime.getByDayOfWeek does not support multiple dates.");
+ // disabled for multiple sites
+ if (count($archive->getParams()->getIdSites()) > 1) {
+ throw new Exception("VisitTime.getByDayOfWeek does not support multiple sites.");
}
- $dataTable = $archive->getDataTableFromNumeric($metrics);
+ $dataTable = $archive->getDataTableFromNumeric($metrics)->mergeChildren();
- if(!($dataTable instanceof Piwik_DataTable)) {
- return new Piwik_DataTable();
- }
// if there's no data for this report, don't bother w/ anything else
if ($dataTable->getRowsCount() == 0) {
return $dataTable;