diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2009-03-30 06:22:03 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2009-03-30 06:22:03 +0400 |
commit | e0507d715f281f56e10d0b87dc4e013f3aba96c1 (patch) | |
tree | 6c7740e8e5dffaa4006b9208324a1952bac49469 /plugins/VisitorInterest/API.php | |
parent | 13158516543fd79913f4a5e1a393dc3d5bc1ab31 (diff) |
- fixing recently introduced sorting issue, refactoring, cleaning up the generic filters concept by removing the automatic sorting of data
- fixing issue when executing unit tests would invalidate tmp/cache/tracker files
- fixed edge case issue when calling several apis from one http request, and requesting recursive output, it was failing in some random cases
- adding a unit test that calls all callable api methods and check for non empty output
-
git-svn-id: http://dev.piwik.org/svn/trunk@1041 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/VisitorInterest/API.php')
-rw-r--r-- | plugins/VisitorInterest/API.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/VisitorInterest/API.php b/plugins/VisitorInterest/API.php index 2903c3eabf..9afab8ce1a 100644 --- a/plugins/VisitorInterest/API.php +++ b/plugins/VisitorInterest/API.php @@ -27,28 +27,28 @@ class Piwik_VisitorInterest_API return self::$instance; } - public function getNumberOfVisitsPerVisitDuration( $idSite, $period, $date ) + protected function getDataTable($name, $idSite, $period, $date) { Piwik::checkUserHasViewAccess( $idSite ); $archive = Piwik_Archive::build($idSite, $period, $date ); - $dataTable = $archive->getDataTable('VisitorInterest_timeGap'); - + $dataTable = $archive->getDataTable($name); + $filter = new Piwik_DataTable_Filter_Sort($dataTable, Piwik_Archive::INDEX_NB_VISITS); $dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames'); $dataTable->queueFilter('Piwik_DataTable_Filter_Sort', array('label', 'asc', true)); - $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getDurationLabel')); + return $dataTable; + } + public function getNumberOfVisitsPerVisitDuration( $idSite, $period, $date ) + { + $dataTable = $this->getDataTable('VisitorInterest_timeGap', $idSite, $period, $date); + $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getDurationLabel')); return $dataTable; } public function getNumberOfVisitsPerPage( $idSite, $period, $date ) { - Piwik::checkUserHasViewAccess( $idSite ); - $archive = Piwik_Archive::build($idSite, $period, $date ); - $dataTable = $archive->getDataTable('VisitorInterest_pageGap'); - $dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames'); - $dataTable->queueFilter('Piwik_DataTable_Filter_Sort', array('label', 'asc', true)); + $dataTable = $this->getDataTable('VisitorInterest_pageGap', $idSite, $period, $date); $dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getPageGapLabel')); - return $dataTable; } } |