[Piwik-svn] r379 - in trunk: modules/DataTable plugins/Actions
svnmaster at piwik.org
svnmaster at piwik.org
Mon Mar 17 11:15:46 CET 2008
Author: matt
Date: 2008-03-17 11:15:44 +0100 (Mon, 17 Mar 2008)
New Revision: 379
Modified:
trunk/modules/DataTable/Row.php
trunk/plugins/Actions/Actions.php
Log:
- fix #147 ; this is not retroactive so the bug should not appear in future stats, but will still be there for past data
Modified: trunk/modules/DataTable/Row.php
===================================================================
--- trunk/modules/DataTable/Row.php 2008-03-17 09:54:28 UTC (rev 378)
+++ trunk/modules/DataTable/Row.php 2008-03-17 10:15:44 UTC (rev 379)
@@ -40,16 +40,16 @@
*
* @param array The row array has the structure
* array(
- * DataTable_Row::COLUMNS => array(
+ * Piwik_DataTable_Row::COLUMNS => array(
* 0 => 1554,
* 1 => 42,
* 2 => 657,
* 3 => 155744,
* ),
- * DataTable_Row::DETAILS => array(
+ * Piwik_DataTable_Row::DETAILS => array(
* 'logo' => 'test.png'
* ),
- * DataTable_Row::DATATABLE_ASSOCIATED => #DataTable object // numeric idDataTable
+ * Piwik_DataTable_Row::DATATABLE_ASSOCIATED => #DataTable object // numeric idDataTable
* )
*/
public function __construct( $row = array() )
Modified: trunk/plugins/Actions/Actions.php
===================================================================
--- trunk/plugins/Actions/Actions.php 2008-03-17 09:54:28 UTC (rev 378)
+++ trunk/plugins/Actions/Actions.php 2008-03-17 10:15:44 UTC (rev 379)
@@ -92,6 +92,16 @@
Piwik_LogStats_Action::TYPE_OUTLINK => array(),
);
+ // This row is used in the case where an action is know as an exit_action
+ // but this action was not properly recorded when it was hit in the first place
+ // so we add this fake row information to make sure there is a nb_hits, etc. column for every action
+ $this->defaultRow = new Piwik_DataTable_Row(array(
+ Piwik_DataTable_Row::COLUMNS => array(
+ 'nb_visits' => 1,
+ 'nb_uniq_visitors' => 1,
+ 'nb_hits' => 1,
+ )));
+
/*
* Actions global information
*/
@@ -107,7 +117,7 @@
AND idsite = ?
GROUP BY t3.idaction";
$query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite ));
-
+
$modified = $this->updateActionsTableWithRowQuery($query);
@@ -149,7 +159,7 @@
GROUP BY visit_exit_idaction
";
$query = $archiveProcessing->db->query($query, array( $archiveProcessing->strDateStart, $archiveProcessing->idsite ));
-
+
$modified = $this->updateActionsTableWithRowQuery($query);
/*
@@ -256,16 +266,27 @@
foreach($row as $name => $value)
{
- // we don't add this information as it not pertinent
+ // we don't add this information as itnot pertinent
// name is already set as the label // and it has been cleaned from the categories and extracted from the initial string
// type is used to partition the different actions type in different table. Adding the info to the row would be a duplicate.
if($name != 'name' && $name != 'type')
{
-// $name = $this->getIdColumn($name);
$currentTable->addColumn($name, $value);
}
}
-
+
+ // if the exit_action was not recorded properly in the log_link_visit_action
+ // there would be an error message when getting the nb_hits column
+ // we must fake the record and add the columns
+ if($currentTable->getColumn('nb_hits') === false)
+ {
+ // to test this code: delete the entries in log_link_action_visit for
+ // a given exit_idaction
+ foreach($this->defaultRow->getColumns() as $name => $value)
+ {
+ $currentTable->addColumn($name, $value);
+ }
+ }
// simple count
$rowsProcessed++;
}
More information about the Piwik-svn
mailing list