Skip to content
Extraits de code Groupes Projets
Valider e37db246 rédigé par mattab's avatar mattab
Parcourir les fichiers

filter_excludelowpop=nb_visits should work even before 'ReplaceColumnNames' filter has been called

parent 19e40520
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -10,6 +10,7 @@ namespace Piwik\DataTable\Filter; ...@@ -10,6 +10,7 @@ namespace Piwik\DataTable\Filter;
use Piwik\DataTable; use Piwik\DataTable;
use Piwik\DataTable\BaseFilter; use Piwik\DataTable\BaseFilter;
use Piwik\Metrics;
/** /**
* Deletes all rows for which a specific column has a value that is lower than * Deletes all rows for which a specific column has a value that is lower than
...@@ -60,7 +61,12 @@ class ExcludeLowPopulation extends BaseFilter ...@@ -60,7 +61,12 @@ class ExcludeLowPopulation extends BaseFilter
{ {
parent::__construct($table); parent::__construct($table);
$this->columnToFilter = $columnToFilter; $row = $table->getFirstRow();
if ($row === false) {
return;
}
$this->columnToFilter = $this->selectColumnToExclude($columnToFilter, $row);
if ($minimumValue == 0) { if ($minimumValue == 0) {
if ($minimumPercentageThreshold === false) { if ($minimumPercentageThreshold === false) {
...@@ -88,4 +94,29 @@ class ExcludeLowPopulation extends BaseFilter ...@@ -88,4 +94,29 @@ class ExcludeLowPopulation extends BaseFilter
$table->filter('ColumnCallbackDeleteRow', array($this->columnToFilter, $isValueLowPopulation)); $table->filter('ColumnCallbackDeleteRow', array($this->columnToFilter, $isValueLowPopulation));
} }
/**
* Sets the column to be used for Excluding low population
*
* @param DataTable\Row $row
* @return int
*/
private function selectColumnToExclude($columnToFilter, $row)
{
if ($row->hasColumn($columnToFilter)) {
return $columnToFilter;
}
// filter_excludelowpop=nb_visits but the column name is still Metrics::INDEX_NB_VISITS in the table
$columnIdToName = Metrics::getMappingFromNameToId();
if (isset($columnIdToName[$columnToFilter])) {
$column = $columnIdToName[$columnToFilter];
if ($row->hasColumn($column)) {
return $column;
}
}
return $columnToFilter;
}
} }
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