Skip to content
Extraits de code Groupes Projets
Valider c10a289b rédigé par Matthieu Aubry's avatar Matthieu Aubry Validation de GitHub
Parcourir les fichiers

Apply ReplaceSummaryRowLabel filter when flattening (#10935)

* Apply ReplaceSummaryRowLabel filter when flattening

* Also apply filter in parent table

* Clarify that the filter is recursive
parent b847e3bb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 35 ajouts et 24 suppressions
...@@ -63,13 +63,25 @@ class Flattener extends DataTableManipulator ...@@ -63,13 +63,25 @@ class Flattener extends DataTableManipulator
{ {
$newDataTable = $dataTable->getEmptyClone($keepFilters = true); $newDataTable = $dataTable->getEmptyClone($keepFilters = true);
foreach ($dataTable->getRows() as $rowId => $row) { // this recursive filter will be applied to subtables
$this->flattenRow($row, $rowId, $newDataTable); $dataTable->filter('ReplaceSummaryRowLabel');
}
$this->flattenDataTableInto($dataTable, $newDataTable);
return $newDataTable; return $newDataTable;
} }
/**
* @param $dataTable DataTable
* @param $newDataTable
*/
protected function flattenDataTableInto($dataTable, $newDataTable, $prefix = '', $logo = false)
{
foreach ($dataTable->getRows() as $rowId => $row) {
$this->flattenRow($row, $rowId, $newDataTable, $prefix, $logo);
}
}
/** /**
* @param Row $row * @param Row $row
* @param DataTable $dataTable * @param DataTable $dataTable
...@@ -124,9 +136,7 @@ class Flattener extends DataTableManipulator ...@@ -124,9 +136,7 @@ class Flattener extends DataTableManipulator
$dataTable->addRow($row); $dataTable->addRow($row);
} }
$prefix = $label . $this->recursiveLabelSeparator; $prefix = $label . $this->recursiveLabelSeparator;
foreach ($subTable->getRows() as $rowId => $row) { $this->flattenDataTableInto($subTable, $dataTable, $prefix, $logo);
$this->flattenRow($row, $rowId, $dataTable, $prefix, $logo);
}
} }
} }
...@@ -142,4 +152,5 @@ class Flattener extends DataTableManipulator ...@@ -142,4 +152,5 @@ class Flattener extends DataTableManipulator
return $request; return $request;
} }
} }
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<row> <row>
<label>cloudsite5.com/-1</label> <label>cloudsite5.com/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<avg_bandwidth>0</avg_bandwidth> <avg_bandwidth>0</avg_bandwidth>
</row> </row>
<row> <row>
<label>cloudsite6.com/-1</label> <label>cloudsite6.com/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<avg_bandwidth>0</avg_bandwidth> <avg_bandwidth>0</avg_bandwidth>
</row> </row>
<row> <row>
<label>cloudsite7.com/-1</label> <label>cloudsite7.com/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<row> <row>
<label>othersite10.com/-1</label> <label>othersite10.com/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<avg_bandwidth>0</avg_bandwidth> <avg_bandwidth>0</avg_bandwidth>
</row> </row>
<row> <row>
<label>othersite11.com/-1</label> <label>othersite11.com/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<avg_bandwidth>0</avg_bandwidth> <avg_bandwidth>0</avg_bandwidth>
</row> </row>
<row> <row>
<label>othersite12.com/-1</label> <label>othersite12.com/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<exit_rate>100%</exit_rate> <exit_rate>100%</exit_rate>
</row> </row>
<row> <row>
<label>title_0/-1</label> <label>title_0/ - Others</label>
<nb_visits>3</nb_visits> <nb_visits>3</nb_visits>
<nb_hits>3</nb_hits> <nb_hits>3</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<row> <row>
<label>0/-1</label> <label>0/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<exit_rate>100%</exit_rate> <exit_rate>100%</exit_rate>
</row> </row>
<row> <row>
<label>1/-1</label> <label>1/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<exit_rate>100%</exit_rate> <exit_rate>100%</exit_rate>
</row> </row>
<row> <row>
<label>2/-1</label> <label>2/ - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_hits>4</nb_hits> <nb_hits>4</nb_hits>
<sum_time_spent>0</sum_time_spent> <sum_time_spent>0</sum_time_spent>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<row> <row>
<label>name - -1</label> <label>name - Others</label>
<nb_visits>19</nb_visits> <nb_visits>19</nb_visits>
<nb_actions>19</nb_actions> <nb_actions>19</nb_actions>
</row> </row>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<nb_actions>16</nb_actions> <nb_actions>16</nb_actions>
</row> </row>
<row> <row>
<label>liked - -1</label> <label>liked - Others</label>
<nb_visits>4</nb_visits> <nb_visits>4</nb_visits>
<nb_actions>4</nb_actions> <nb_actions>4</nb_actions>
</row> </row>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<row> <row>
<label>Unknown</label> <label>Others</label>
<nb_uniq_visitors>9</nb_uniq_visitors> <nb_uniq_visitors>9</nb_uniq_visitors>
<nb_visits>45</nb_visits> <nb_visits>45</nb_visits>
<nb_actions>45</nb_actions> <nb_actions>45</nb_actions>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<row> <row>
<label>this search term - -1</label> <label>this search term - Others</label>
<nb_uniq_visitors>2</nb_uniq_visitors> <nb_uniq_visitors>2</nb_uniq_visitors>
<nb_visits>2</nb_visits> <nb_visits>2</nb_visits>
<nb_actions>2</nb_actions> <nb_actions>2</nb_actions>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<row> <row>
<label>Google - -1</label> <label>Google - Others</label>
<nb_uniq_visitors>2</nb_uniq_visitors> <nb_uniq_visitors>2</nb_uniq_visitors>
<nb_visits>2</nb_visits> <nb_visits>2</nb_visits>
<nb_actions>2</nb_actions> <nb_actions>2</nb_actions>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<logo>plugins/Referrers/images/searchEngines/google.com.png</logo> <logo>plugins/Referrers/images/searchEngines/google.com.png</logo>
</row> </row>
<row> <row>
<label>Yahoo! - -1</label> <label>Yahoo! - Others</label>
<nb_uniq_visitors>2</nb_uniq_visitors> <nb_uniq_visitors>2</nb_uniq_visitors>
<nb_visits>2</nb_visits> <nb_visits>2</nb_visits>
<nb_actions>2</nb_actions> <nb_actions>2</nb_actions>
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<row> <row>
<label>whatever0.com/-1</label> <label>whatever0.com/ - Others</label>
<nb_uniq_visitors>2</nb_uniq_visitors> <nb_uniq_visitors>2</nb_uniq_visitors>
<nb_visits>2</nb_visits> <nb_visits>2</nb_visits>
<nb_actions>2</nb_actions> <nb_actions>2</nb_actions>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<sum_visit_length>0</sum_visit_length> <sum_visit_length>0</sum_visit_length>
<bounce_count>2</bounce_count> <bounce_count>2</bounce_count>
<nb_visits_converted>0</nb_visits_converted> <nb_visits_converted>0</nb_visits_converted>
<url>-1</url> <url>Others</url>
</row> </row>
<row> <row>
<label>whatever0.com/index</label> <label>whatever0.com/index</label>
......
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