Skip to content
Extraits de code Groupes Projets
Valider 1c42224b rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Done.

parent c63ca289
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -164,7 +164,7 @@ class Period extends ArchiveProcessor ...@@ -164,7 +164,7 @@ class Period extends ArchiveProcessor
{ {
$table = new DataTable(); $table = new DataTable();
if (!empty($columnAggregationOperations)) { if (!empty($columnAggregationOperations)) {
$table->setColumnAggregationOperations($columnAggregationOperations); $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME] = $columnAggregationOperations;
} }
$data = $this->archiver->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false); $data = $this->archiver->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false);
......
Ce diff est replié.
...@@ -78,10 +78,10 @@ class AddSummaryRow extends Filter ...@@ -78,10 +78,10 @@ class AddSummaryRow extends Filter
//FIXME: I'm not sure why it could return false, but it was reported in: http://forum.piwik.org/read.php?2,89324,page=1#msg-89442 //FIXME: I'm not sure why it could return false, but it was reported in: http://forum.piwik.org/read.php?2,89324,page=1#msg-89442
if ($summaryRow) { if ($summaryRow) {
$newRow->sumRow($summaryRow, $enableCopyMetadata = false, $table->getColumnAggregationOperations()); $newRow->sumRow($summaryRow, $enableCopyMetadata = false, $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]);
} }
} else { } else {
$newRow->sumRow($rows[$i], $enableCopyMetadata = false, $table->getColumnAggregationOperations()); $newRow->sumRow($rows[$i], $enableCopyMetadata = false, $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]);
} }
} }
......
...@@ -87,7 +87,7 @@ class GroupBy extends Filter ...@@ -87,7 +87,7 @@ class GroupBy extends Filter
} else { } else {
// if we have already encountered this group by value, we add this row to the // if we have already encountered this group by value, we add this row to the
// row that will be kept, and mark this one for deletion // row that will be kept, and mark this one for deletion
$groupByRows[$groupByValue]->sumRow($row, $copyMeta = true, $table->getColumnAggregationOperations()); $groupByRows[$groupByValue]->sumRow($row, $copyMeta = true, $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]);
$nonGroupByRowIds[] = $rowId; $nonGroupByRowIds[] = $rowId;
} }
} }
......
...@@ -45,7 +45,7 @@ class Limit extends Filter ...@@ -45,7 +45,7 @@ class Limit extends Filter
*/ */
public function filter($table) public function filter($table)
{ {
$table->setRowsCountBeforeLimitFilter(); $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME] = $table->getRowsCount();
if ($this->keepSummaryRow) { if ($this->keepSummaryRow) {
$summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW); $summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW);
......
...@@ -287,7 +287,8 @@ class Row ...@@ -287,7 +287,8 @@ class Row
$thisSubTable = new DataTable(); $thisSubTable = new DataTable();
$this->addSubtable($thisSubTable); $this->addSubtable($thisSubTable);
} }
$thisSubTable->setColumnAggregationOperations($subTable->getColumnAggregationOperations()); $thisSubTable->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]
= $subTable->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME];
$thisSubTable->addDataTable($subTable); $thisSubTable->addDataTable($subTable);
} }
......
...@@ -59,7 +59,7 @@ class DataTableSummaryRow extends Row ...@@ -59,7 +59,7 @@ class DataTableSummaryRow extends Row
private function sumTable($table) private function sumTable($table)
{ {
foreach ($table->getRows() as $row) { foreach ($table->getRows() as $row) {
$this->sumRow($row, $enableCopyMetadata = false, $table->getColumnAggregationOperations()); $this->sumRow($row, $enableCopyMetadata = false, $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]);
} }
} }
} }
...@@ -175,7 +175,7 @@ class Visualization extends ViewDataTable ...@@ -175,7 +175,7 @@ class Visualization extends ViewDataTable
// deal w/ table metadata // deal w/ table metadata
if ($this->dataTable instanceof DataTable) { if ($this->dataTable instanceof DataTable) {
$this->config->metadata = $this->dataTable->getAllTableMetadata(); $this->config->metadata = $this->dataTable->metadata;
if (isset($this->config->metadata[DataTable::ARCHIVED_DATE_METADATA_NAME])) { if (isset($this->config->metadata[DataTable::ARCHIVED_DATE_METADATA_NAME])) {
$this->config->report_last_updated_message = $this->makePrettyArchivedOnText(); $this->config->report_last_updated_message = $this->makePrettyArchivedOnText();
...@@ -372,7 +372,8 @@ class Visualization extends ViewDataTable ...@@ -372,7 +372,8 @@ class Visualization extends ViewDataTable
!($this->dataTable instanceof DataTable\Map) !($this->dataTable instanceof DataTable\Map)
&& empty($javascriptVariablesToSet['totalRows']) && empty($javascriptVariablesToSet['totalRows'])
) { ) {
$javascriptVariablesToSet['totalRows'] = $this->dataTable->getRowsCountBeforeLimitFilter(); $javascriptVariablesToSet['totalRows'] =
$this->dataTable->getMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME) ?: $this->dataTable->getRowsCount();
} }
$deleteFromJavascriptVariables = array( $deleteFromJavascriptVariables = array(
......
...@@ -166,7 +166,7 @@ class Archiver extends \Piwik\Plugin\Archiver ...@@ -166,7 +166,7 @@ class Archiver extends \Piwik\Plugin\Archiver
|| $type == Action::TYPE_ACTION_NAME || $type == Action::TYPE_ACTION_NAME
) { ) {
// for page urls and page titles, performance metrics exist and have to be aggregated correctly // for page urls and page titles, performance metrics exist and have to be aggregated correctly
$dataTable->setColumnAggregationOperations(self::$actionColumnAggregationOperations); $dataTable->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME] = self::$actionColumnAggregationOperations;
} }
$this->actionsTablesByType[$type] = $dataTable; $this->actionsTablesByType[$type] = $dataTable;
......
...@@ -219,7 +219,7 @@ class API extends \Piwik\Plugin\API ...@@ -219,7 +219,7 @@ class API extends \Piwik\Plugin\API
// When Truncate filter is applied, it will call AddSummaryRow which tries to sum all rows. // When Truncate filter is applied, it will call AddSummaryRow which tries to sum all rows.
// We tell the object to skip the column nb_visits_percentage when aggregating (since it's not correct to sum % values) // We tell the object to skip the column nb_visits_percentage when aggregating (since it's not correct to sum % values)
$table->setColumnAggregationOperation('nb_visits_percentage', 'skip'); $table->metadata[DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME]['nb_visits_percentage'] = 'skip';
// The filter must be applied now so that the new column can // The filter must be applied now so that the new column can
// be sorted by the generic filters (applied right after this loop exits) // be sorted by the generic filters (applied right after this loop exits)
......
...@@ -383,6 +383,7 @@ abstract class Test_Piwik_BaseFixture extends PHPUnit_Framework_Assert ...@@ -383,6 +383,7 @@ abstract class Test_Piwik_BaseFixture extends PHPUnit_Framework_Assert
// run the command // run the command
exec($cmd, $output, $result); exec($cmd, $output, $result);
echo "OUTPUT: ".implode("\n", $output);
if ($result !== 0) { if ($result !== 0) {
throw new Exception("log importer failed: " . implode("\n", $output) . "\n\ncommand used: $cmd"); throw new Exception("log importer failed: " . implode("\n", $output) . "\n\ncommand used: $cmd");
} }
......
...@@ -49,7 +49,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -49,7 +49,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$this->assertEquals(3, $table->getRowsCount()); $this->assertEquals(3, $table->getRowsCount());
$this->assertEquals(2, $table->getFirstRow()->getColumn('idRow')); $this->assertEquals(2, $table->getFirstRow()->getColumn('idRow'));
$this->assertEquals(4, $table->getLastRow()->getColumn('idRow')); $this->assertEquals(4, $table->getLastRow()->getColumn('idRow'));
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -65,7 +65,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -65,7 +65,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$this->assertEquals(7, $table->getRowsCount()); $this->assertEquals(7, $table->getRowsCount());
$this->assertEquals(2, $table->getFirstRow()->getColumn('idRow')); $this->assertEquals(2, $table->getFirstRow()->getColumn('idRow'));
$this->assertEquals(8, $table->getLastRow()->getColumn('idRow')); $this->assertEquals(8, $table->getLastRow()->getColumn('idRow'));
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -76,13 +76,13 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -76,13 +76,13 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$offset = 0; $offset = 0;
$limit = 10; $limit = 10;
$table = $this->getDataTableCount10(); $table = $this->getDataTableCount10();
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
$filter = new Limit($table, $offset, $limit); $filter = new Limit($table, $offset, $limit);
$filter->filter($table); $filter->filter($table);
$this->assertEquals(10, $table->getRowsCount()); $this->assertEquals(10, $table->getRowsCount());
$this->assertEquals(0, $table->getFirstRow()->getColumn('idRow')); $this->assertEquals(0, $table->getFirstRow()->getColumn('idRow'));
$this->assertEquals(9, $table->getLastRow()->getColumn('idRow')); $this->assertEquals(9, $table->getLastRow()->getColumn('idRow'));
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -93,13 +93,13 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -93,13 +93,13 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$offset = 5; $offset = 5;
$limit = 20; $limit = 20;
$table = $this->getDataTableCount10(); $table = $this->getDataTableCount10();
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
$filter = new Limit($table, $offset, $limit); $filter = new Limit($table, $offset, $limit);
$filter->filter($table); $filter->filter($table);
$this->assertEquals(5, $table->getRowsCount()); $this->assertEquals(5, $table->getRowsCount());
$this->assertEquals(5, $table->getFirstRow()->getColumn('idRow')); $this->assertEquals(5, $table->getFirstRow()->getColumn('idRow'));
$this->assertEquals(9, $table->getLastRow()->getColumn('idRow')); $this->assertEquals(9, $table->getLastRow()->getColumn('idRow'));
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -114,7 +114,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -114,7 +114,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$this->assertEquals(9, $table->getRowsCount()); $this->assertEquals(9, $table->getRowsCount());
$this->assertEquals(1, $table->getFirstRow()->getColumn('idRow')); $this->assertEquals(1, $table->getFirstRow()->getColumn('idRow'));
$this->assertEquals(9, $table->getLastRow()->getColumn('idRow')); $this->assertEquals(9, $table->getLastRow()->getColumn('idRow'));
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -130,7 +130,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -130,7 +130,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $table->getRowsCount()); $this->assertEquals(1, $table->getRowsCount());
$this->assertEquals(9, $table->getFirstRow()->getColumn('idRow')); $this->assertEquals(9, $table->getFirstRow()->getColumn('idRow'));
$this->assertEquals(9, $table->getLastRow()->getColumn('idRow')); $this->assertEquals(9, $table->getLastRow()->getColumn('idRow'));
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -146,7 +146,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -146,7 +146,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$this->assertEquals(1, $table->getRowsCount()); $this->assertEquals(1, $table->getRowsCount());
$this->assertEquals(9, $table->getFirstRow()->getColumn('idRow')); $this->assertEquals(9, $table->getFirstRow()->getColumn('idRow'));
$this->assertEquals(9, $table->getLastRow()->getColumn('idRow')); $this->assertEquals(9, $table->getLastRow()->getColumn('idRow'));
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -162,7 +162,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -162,7 +162,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$this->assertEquals(2, $table->getRowsCount()); $this->assertEquals(2, $table->getRowsCount());
$this->assertEquals(8, $table->getFirstRow()->getColumn('idRow')); $this->assertEquals(8, $table->getFirstRow()->getColumn('idRow'));
$this->assertEquals(9, $table->getLastRow()->getColumn('idRow')); $this->assertEquals(9, $table->getLastRow()->getColumn('idRow'));
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -176,7 +176,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -176,7 +176,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$filter = new Limit($table, $offset, $limit); $filter = new Limit($table, $offset, $limit);
$filter->filter($table); $filter->filter($table);
$this->assertEquals(0, $table->getRowsCount()); $this->assertEquals(0, $table->getRowsCount());
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
...@@ -190,7 +190,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase ...@@ -190,7 +190,7 @@ class DataTable_Filter_LimitTest extends PHPUnit_Framework_TestCase
$filter = new Limit($table, $offset, $limit); $filter = new Limit($table, $offset, $limit);
$filter->filter($table); $filter->filter($table);
$this->assertEquals(0, $table->getRowsCount()); $this->assertEquals(0, $table->getRowsCount());
$this->assertEquals(10, $table->getRowsCountBeforeLimitFilter()); $this->assertEquals(10, $table->metadata[DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME]);
} }
/** /**
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter