diff options
author | Stefan Giehl <stefan@piwik.org> | 2018-09-05 02:56:29 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-09-05 02:56:29 +0300 |
commit | 7c7f6da66d2bb9dde9eacb057638ee942e40acb9 (patch) | |
tree | 9f3647220e88112023b15549f09692dc54a20a42 | |
parent | 0738e5ff6b262ab6179f2dda5216b44d3a919ed4 (diff) |
Stable sort for most frequent segment values (#13286)
* Use a stable sort when sorting most frequent segment values
* update test files
39 files changed, 159 insertions, 143 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php index 83bdc04623..fa913d887f 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -693,7 +693,7 @@ class API extends \Piwik\Plugin\API /** * @param $values - * @param $value + * * @return array */ private function getMostFrequentValues($values) @@ -710,9 +710,25 @@ class API extends \Piwik\Plugin\API // we have a list of all values. let's show the most frequently used first. $values = array_count_values($values); - arsort($values); - $values = array_keys($values); - return $values; + // Sort this list by converting and sorting the array with custom method, so the result doesn't differ between PHP versions + $sortArray = []; + + foreach ($values as $value => $count) { + $sortArray[] = [ + 'value' => $value, + 'count' => $count + ]; + } + + usort($sortArray, function($a, $b) { + if ($a['count'] == $b['count']) { + return strcmp($a['value'], $b['value']); + } + + return $a['count'] > $b['count'] ? -1 : 1; + }); + + return array_column($sortArray, 'value'); } private function doesSuggestedValuesCallbackNeedData($suggestedValuesCallback) diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_actionUrl__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_actionUrl__API.getSuggestedValuesForSegment.xml index 2aaf85d5c1..57bba2b33a 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_actionUrl__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_actionUrl__API.getSuggestedValuesForSegment.xml @@ -2,22 +2,22 @@ <result> <row>http://piwik.net/space/quest/iv</row> <row>http://piwik.net/grue/lair</row> - <row>http://example.org/path/file1.zip</row> - <row>http://example.org/path/file0.zip</row> - <row>http://example-outlink.org/1.html</row> <row>http://example-outlink.org/0.html</row> - <row>http://example-outlink.org/3.html</row> - <row>http://example.org/path/file3.zip</row> + <row>http://example-outlink.org/1.html</row> + <row>http://example.org/path/file0.zip</row> + <row>http://example.org/path/file1.zip</row> <row>http://example-outlink.org/2.html</row> + <row>http://example-outlink.org/3.html</row> <row>http://example.org/path/file2.zip</row> + <row>http://example.org/path/file3.zip</row> + <row>http://example-outlink.org/4.html</row> + <row>http://example-outlink.org/5.html</row> + <row>http://example-outlink.org/6.html</row> <row>http://example-outlink.org/7.html</row> <row>http://example-outlink.org/8.html</row> <row>http://example.org/path/file4.zip</row> - <row>http://example-outlink.org/6.html</row> + <row>http://example.org/path/file5.zip</row> <row>http://example.org/path/file6.zip</row> - <row>http://example-outlink.org/4.html</row> - <row>http://example-outlink.org/5.html</row> - <row>http://example.org/path/file8.zip</row> <row>http://example.org/path/file7.zip</row> - <row>http://example.org/path/file5.zip</row> + <row>http://example.org/path/file8.zip</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_browserCode__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_browserCode__API.getSuggestedValuesForSegment.xml index 43031de55b..f40c864e4f 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_browserCode__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_browserCode__API.getSuggestedValuesForSegment.xml @@ -3,8 +3,8 @@ <row>FF</row> <row>CH</row> <row>IE</row> - <row>QQ</row> - <row>CM</row> <row>AN</row> + <row>CM</row> + <row>QQ</row> <row>SF</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_browserVersion__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_browserVersion__API.getSuggestedValuesForSegment.xml index 91740cd18d..e5183cb661 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_browserVersion__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_browserVersion__API.getSuggestedValuesForSegment.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row>3.6</row> + <row>11</row> + <row>3</row> <row>32</row> - <row>5</row> <row>33</row> - <row>8</row> <row>34</row> - <row>11</row> - <row>3</row> + <row>5</row> + <row>8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_city__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_city__API.getSuggestedValuesForSegment.xml index c5a7afa2b4..3eb5552994 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_city__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_city__API.getSuggestedValuesForSegment.xml @@ -3,9 +3,9 @@ <row>Stratford-upon-Avon</row> <row>Vancouver</row> <row>Besançon</row> - <row>Nuneaton and Bedworth</row> - <row>London</row> - <row>Lhasa</row> <row>Hluboká nad Vltavou</row> + <row>Lhasa</row> + <row>London</row> + <row>Nuneaton and Bedworth</row> <row>not a city</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_countryCode__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_countryCode__API.getSuggestedValuesForSegment.xml index 57ad401634..e820badd0e 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_countryCode__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_countryCode__API.getSuggestedValuesForSegment.xml @@ -4,10 +4,10 @@ <row>ca</row> <row>ru</row> <row>us</row> - <row>it</row> + <row>cn</row> <row>fr</row> <row>id</row> - <row>cn</row> + <row>it</row> <row>mk</row> <row>xx</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageName__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageName__API.getSuggestedValuesForSegment.xml index 77fa6e91a9..c26e714a25 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageName__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageName__API.getSuggestedValuesForSegment.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cvar 5 PAGE name</row> <row>Cvar 2 PAGE name</row> + <row>Cvar 5 PAGE name</row> <row>Search Category</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue2__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue2__API.getSuggestedValuesForSegment.xml index 18b4e9b372..79849260d4 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue2__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue2__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cvar2 PAGE value is 1</row> <row>Cvar2 PAGE value is 0</row> + <row>Cvar2 PAGE value is 1</row> <row>Cvar2 PAGE value is 2</row> <row>Cvar2 PAGE value is 3</row> <row>Cvar2 PAGE value is 4</row> - <row>Cvar2 PAGE value is 7</row> - <row>Cvar2 PAGE value is 6</row> <row>Cvar2 PAGE value is 5</row> + <row>Cvar2 PAGE value is 6</row> + <row>Cvar2 PAGE value is 7</row> <row>Cvar2 PAGE value is 8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue5__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue5__API.getSuggestedValuesForSegment.xml index 0425837789..9ce36b0f97 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue5__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue5__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cvar5 PAGE value is 1</row> <row>Cvar5 PAGE value is 0</row> + <row>Cvar5 PAGE value is 1</row> <row>Cvar5 PAGE value is 2</row> <row>Cvar5 PAGE value is 3</row> <row>Cvar5 PAGE value is 4</row> - <row>Cvar5 PAGE value is 7</row> - <row>Cvar5 PAGE value is 6</row> <row>Cvar5 PAGE value is 5</row> + <row>Cvar5 PAGE value is 6</row> + <row>Cvar5 PAGE value is 7</row> <row>Cvar5 PAGE value is 8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue__API.getSuggestedValuesForSegment.xml index 0ab1e3a74c..e20cde6740 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariablePageValue__API.getSuggestedValuesForSegment.xml @@ -1,22 +1,22 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row>CAT</row> + <row>Cvar2 PAGE value is 0</row> + <row>Cvar2 PAGE value is 1</row> <row>Cvar5 PAGE value is 0</row> <row>Cvar5 PAGE value is 1</row> - <row>Cvar2 PAGE value is 1</row> - <row>Cvar2 PAGE value is 0</row> + <row>Cvar2 PAGE value is 2</row> <row>Cvar2 PAGE value is 3</row> <row>Cvar5 PAGE value is 2</row> <row>Cvar5 PAGE value is 3</row> - <row>Cvar2 PAGE value is 2</row> - <row>Cvar2 PAGE value is 5</row> <row>Cvar2 PAGE value is 4</row> + <row>Cvar2 PAGE value is 5</row> <row>Cvar2 PAGE value is 6</row> - <row>Cvar5 PAGE value is 8</row> + <row>Cvar2 PAGE value is 7</row> + <row>Cvar2 PAGE value is 8</row> + <row>Cvar5 PAGE value is 4</row> <row>Cvar5 PAGE value is 5</row> <row>Cvar5 PAGE value is 6</row> - <row>Cvar5 PAGE value is 4</row> <row>Cvar5 PAGE value is 7</row> - <row>Cvar2 PAGE value is 8</row> - <row>Cvar2 PAGE value is 7</row> + <row>Cvar5 PAGE value is 8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue1__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue1__API.getSuggestedValuesForSegment.xml index b157cb068a..641de91df2 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue1__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue1__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cvar1 value is 1</row> <row>Cvar1 value is 0</row> + <row>Cvar1 value is 1</row> <row>Cvar1 value is 2</row> <row>Cvar1 value is 3</row> <row>Cvar1 value is 4</row> - <row>Cvar1 value is 7</row> - <row>Cvar1 value is 6</row> <row>Cvar1 value is 5</row> + <row>Cvar1 value is 6</row> + <row>Cvar1 value is 7</row> <row>Cvar1 value is 8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue1__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue1__VisitsSummary.get_range.xml index 2748f63834..f3e5435061 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue1__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue1__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>7</nb_visits> - <nb_actions>16</nb_actions> + <nb_actions>19</nb_actions> <nb_visits_converted>7</nb_visits_converted> <bounce_count>4</bounce_count> <sum_visit_length>4863</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>57%</bounce_rate> - <nb_actions_per_visit>2.3</nb_actions_per_visit> + <nb_actions_per_visit>2.7</nb_actions_per_visit> <avg_time_on_site>695</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue5__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue5__API.getSuggestedValuesForSegment.xml index 40b2b0992a..4ad457f263 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue5__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue5__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cvar5 value is 1</row> <row>Cvar5 value is 0</row> + <row>Cvar5 value is 1</row> <row>Cvar5 value is 2</row> <row>Cvar5 value is 3</row> <row>Cvar5 value is 4</row> - <row>Cvar5 value is 7</row> - <row>Cvar5 value is 6</row> <row>Cvar5 value is 5</row> + <row>Cvar5 value is 6</row> + <row>Cvar5 value is 7</row> <row>Cvar5 value is 8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue5__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue5__VisitsSummary.get_range.xml index 2748f63834..f3e5435061 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue5__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue5__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>7</nb_visits> - <nb_actions>16</nb_actions> + <nb_actions>19</nb_actions> <nb_visits_converted>7</nb_visits_converted> <bounce_count>4</bounce_count> <sum_visit_length>4863</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>57%</bounce_rate> - <nb_actions_per_visit>2.3</nb_actions_per_visit> + <nb_actions_per_visit>2.7</nb_actions_per_visit> <avg_time_on_site>695</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue__API.getSuggestedValuesForSegment.xml index 6be328a177..bf4f5c750d 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue__API.getSuggestedValuesForSegment.xml @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cvar1 value is 1</row> <row>Cvar1 value is 0</row> - <row>Cvar5 value is 1</row> + <row>Cvar1 value is 1</row> <row>Cvar5 value is 0</row> - <row>Cvar1 value is 3</row> + <row>Cvar5 value is 1</row> <row>Cvar1 value is 2</row> + <row>Cvar1 value is 3</row> <row>Cvar5 value is 2</row> <row>Cvar5 value is 3</row> <row>Cvar1 value is 4</row> - <row>Cvar5 value is 7</row> <row>Cvar1 value is 5</row> - <row>Cvar5 value is 6</row> + <row>Cvar1 value is 6</row> <row>Cvar1 value is 7</row> - <row>Cvar5 value is 5</row> - <row>Cvar5 value is 8</row> <row>Cvar1 value is 8</row> <row>Cvar5 value is 4</row> - <row>Cvar1 value is 6</row> + <row>Cvar5 value is 5</row> + <row>Cvar5 value is 6</row> + <row>Cvar5 value is 7</row> + <row>Cvar5 value is 8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue__VisitsSummary.get_range.xml index 2748f63834..f3e5435061 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_customVariableValue__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>7</nb_visits> - <nb_actions>16</nb_actions> + <nb_actions>19</nb_actions> <nb_visits_converted>7</nb_visits_converted> <bounce_count>4</bounce_count> <sum_visit_length>4863</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>57%</bounce_rate> - <nb_actions_per_visit>2.3</nb_actions_per_visit> + <nb_actions_per_visit>2.7</nb_actions_per_visit> <avg_time_on_site>695</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_deviceBrand__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_deviceBrand__API.getSuggestedValuesForSegment.xml index 6929bcb5c1..981ff8e068 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_deviceBrand__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_deviceBrand__API.getSuggestedValuesForSegment.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row>Unknown</row> - <row>Samsung</row> - <row>Google</row> <row>Dell</row> - <row>Sony</row> + <row>Google</row> <row>HTC</row> + <row>Samsung</row> + <row>Sony</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_deviceModel__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_deviceModel__API.getSuggestedValuesForSegment.xml index f2fa6fe257..3e7a99414c 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_deviceModel__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_deviceModel__API.getSuggestedValuesForSegment.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row>Generic Desktop</row> + <row>Desire</row> <row>GALAXY Note 3</row> <row>Nexus 4</row> - <row>Desire</row> <row>Xperia Tablet S</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_downloadUrl__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_downloadUrl__API.getSuggestedValuesForSegment.xml index b30da2f6c7..6a41edacad 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_downloadUrl__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_downloadUrl__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>http://example.org/path/file1.zip</row> <row>http://example.org/path/file0.zip</row> + <row>http://example.org/path/file1.zip</row> <row>http://example.org/path/file2.zip</row> <row>http://example.org/path/file3.zip</row> <row>http://example.org/path/file4.zip</row> - <row>http://example.org/path/file7.zip</row> - <row>http://example.org/path/file6.zip</row> <row>http://example.org/path/file5.zip</row> + <row>http://example.org/path/file6.zip</row> + <row>http://example.org/path/file7.zip</row> <row>http://example.org/path/file8.zip</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_downloadUrl__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_downloadUrl__VisitsSummary.get_range.xml index f83f0d8a40..678b7ca235 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_downloadUrl__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_downloadUrl__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>4</nb_visits> - <nb_actions>16</nb_actions> + <nb_actions>20</nb_actions> <nb_visits_converted>4</nb_visits_converted> <bounce_count>0</bounce_count> <sum_visit_length>6484</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>0%</bounce_rate> - <nb_actions_per_visit>4</nb_actions_per_visit> + <nb_actions_per_visit>5</nb_actions_per_visit> <avg_time_on_site>1621</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventAction__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventAction__API.getSuggestedValuesForSegment.xml index df2f6b2dac..54a85499a5 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventAction__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventAction__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Action1</row> <row>Action0</row> + <row>Action1</row> <row>Action2</row> <row>Action3</row> <row>Action4</row> - <row>Action7</row> - <row>Action6</row> <row>Action5</row> + <row>Action6</row> + <row>Action7</row> <row>Action8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventAction__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventAction__VisitsSummary.get_range.xml index f83f0d8a40..678b7ca235 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventAction__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventAction__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>4</nb_visits> - <nb_actions>16</nb_actions> + <nb_actions>20</nb_actions> <nb_visits_converted>4</nb_visits_converted> <bounce_count>0</bounce_count> <sum_visit_length>6484</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>0%</bounce_rate> - <nb_actions_per_visit>4</nb_actions_per_visit> + <nb_actions_per_visit>5</nb_actions_per_visit> <avg_time_on_site>1621</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventCategory__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventCategory__API.getSuggestedValuesForSegment.xml index 952a834c1a..63e871d30b 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventCategory__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventCategory__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Cat1</row> <row>Cat0</row> + <row>Cat1</row> <row>Cat2</row> <row>Cat3</row> <row>Cat4</row> - <row>Cat7</row> - <row>Cat6</row> <row>Cat5</row> + <row>Cat6</row> + <row>Cat7</row> <row>Cat8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventCategory__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventCategory__VisitsSummary.get_range.xml index f83f0d8a40..678b7ca235 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventCategory__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventCategory__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>4</nb_visits> - <nb_actions>16</nb_actions> + <nb_actions>20</nb_actions> <nb_visits_converted>4</nb_visits_converted> <bounce_count>0</bounce_count> <sum_visit_length>6484</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>0%</bounce_rate> - <nb_actions_per_visit>4</nb_actions_per_visit> + <nb_actions_per_visit>5</nb_actions_per_visit> <avg_time_on_site>1621</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventName__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventName__API.getSuggestedValuesForSegment.xml index fa8c853fcf..d3167c7537 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventName__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventName__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>Name1</row> <row>Name0</row> + <row>Name1</row> <row>Name2</row> <row>Name3</row> <row>Name4</row> - <row>Name7</row> - <row>Name6</row> <row>Name5</row> + <row>Name6</row> + <row>Name7</row> <row>Name8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventName__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventName__VisitsSummary.get_range.xml index f83f0d8a40..678b7ca235 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventName__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventName__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>4</nb_visits> - <nb_actions>16</nb_actions> + <nb_actions>20</nb_actions> <nb_visits_converted>4</nb_visits_converted> <bounce_count>0</bounce_count> <sum_visit_length>6484</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>0%</bounce_rate> - <nb_actions_per_visit>4</nb_actions_per_visit> + <nb_actions_per_visit>5</nb_actions_per_visit> <avg_time_on_site>1621</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventValue__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventValue__API.getSuggestedValuesForSegment.xml index 90d8127471..dd0c19e6ec 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventValue__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_eventValue__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>346.678</row> <row>345.678</row> + <row>346.678</row> <row>347.678</row> <row>348.678</row> <row>349.678</row> - <row>352.678</row> - <row>351.678</row> <row>350.678</row> + <row>351.678</row> + <row>352.678</row> <row>353.678</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_latitude__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_latitude__API.getSuggestedValuesForSegment.xml index 8cc367528e..2d7b659de6 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_latitude__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_latitude__API.getSuggestedValuesForSegment.xml @@ -2,9 +2,9 @@ <result> <row>49.25</row> <row>123.456</row> - <row>47.249</row> - <row>38</row> - <row>29.65</row> <row>124.456</row> + <row>29.65</row> + <row>38</row> + <row>47.249</row> <row>1</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_longitude__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_longitude__API.getSuggestedValuesForSegment.xml index 43e5a510a3..dc47a6cecd 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_longitude__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_longitude__API.getSuggestedValuesForSegment.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row>-123.133</row> + <row>-97</row> <row>21.321</row> + <row>22.231</row> <row>6.018</row> - <row>-97</row> <row>91.1</row> - <row>22.231</row> <row>2</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_operatingSystemCode__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_operatingSystemCode__API.getSuggestedValuesForSegment.xml index c79c69b966..0077b052d6 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_operatingSystemCode__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_operatingSystemCode__API.getSuggestedValuesForSegment.xml @@ -2,6 +2,6 @@ <result> <row>WIN</row> <row>AND</row> - <row>UBT</row> <row>MLD</row> + <row>UBT</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_operatingSystemVersion__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_operatingSystemVersion__API.getSuggestedValuesForSegment.xml index 4d86f11bfd..2e7171bf58 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_operatingSystemVersion__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_operatingSystemVersion__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row>XP</row> + <row>4.1</row> + <row>4.3</row> <row>4.4</row> + <row>7</row> + <row>8</row> <row>8.1</row> - <row>4.3</row> <row>9.04</row> <row>Vista</row> - <row>4.1</row> - <row>7</row> - <row>8</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_outlinkUrl__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_outlinkUrl__API.getSuggestedValuesForSegment.xml index 4c58bd37df..5eb4584591 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_outlinkUrl__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_outlinkUrl__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>http://example-outlink.org/1.html</row> <row>http://example-outlink.org/0.html</row> + <row>http://example-outlink.org/1.html</row> <row>http://example-outlink.org/2.html</row> <row>http://example-outlink.org/3.html</row> <row>http://example-outlink.org/4.html</row> - <row>http://example-outlink.org/7.html</row> - <row>http://example-outlink.org/6.html</row> <row>http://example-outlink.org/5.html</row> + <row>http://example-outlink.org/6.html</row> + <row>http://example-outlink.org/7.html</row> <row>http://example-outlink.org/8.html</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_outlinkUrl__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_outlinkUrl__VisitsSummary.get_range.xml index f83f0d8a40..678b7ca235 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_outlinkUrl__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_outlinkUrl__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>4</nb_visits> - <nb_actions>16</nb_actions> + <nb_actions>20</nb_actions> <nb_visits_converted>4</nb_visits_converted> <bounce_count>0</bounce_count> <sum_visit_length>6484</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>0%</bounce_rate> - <nb_actions_per_visit>4</nb_actions_per_visit> + <nb_actions_per_visit>5</nb_actions_per_visit> <avg_time_on_site>1621</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_regionCode__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_regionCode__API.getSuggestedValuesForSegment.xml index 3687cc46dc..9a69fa129e 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_regionCode__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_regionCode__API.getSuggestedValuesForSegment.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>WAR</row> <row>BC</row> + <row>WAR</row> <row>SPE</row> - <row>BFC</row> - <row>XZ</row> - <row>LND</row> <row>18</row> + <row>BFC</row> <row>KEN</row> + <row>LND</row> + <row>XZ</row> <row>CA</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_regionCode__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_regionCode__VisitsSummary.get_range.xml index ca32407536..789c2c6fd1 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_regionCode__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_regionCode__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>6</nb_visits> - <nb_actions>17</nb_actions> + <nb_actions>16</nb_actions> <nb_visits_converted>6</nb_visits_converted> <bounce_count>3</bounce_count> <sum_visit_length>4863</sum_visit_length> <max_actions>5</max_actions> <bounce_rate>50%</bounce_rate> - <nb_actions_per_visit>2.8</nb_actions_per_visit> + <nb_actions_per_visit>2.7</nb_actions_per_visit> <avg_time_on_site>811</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitIp__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitIp__API.getSuggestedValuesForSegment.xml index e969ca3cc5..aeab59dbdd 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitIp__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitIp__API.getSuggestedValuesForSegment.xml @@ -1,20 +1,20 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <row>194.57.91.215</row> - <row>::ffff:137.82.130.49</row> - <row>1.2.4.1</row> - <row>137.82.0.0</row> - <row>103.29.196.229</row> - <row>151.100.101.92</row> - <row>137.82.130.0</row> <row>1.2.4.0</row> - <row>2003:f6:93bf:26f:9ec7:a6ff:fe29:27df</row> + <row>1.2.4.1</row> <row>1.2.4.2</row> - <row>1.2.4.7</row> - <row>1.2.4.8</row> - <row>1.2.4.6</row> - <row>1.2.4.5</row> <row>1.2.4.3</row> <row>1.2.4.4</row> + <row>1.2.4.5</row> + <row>1.2.4.6</row> + <row>1.2.4.7</row> + <row>1.2.4.8</row> + <row>103.29.196.229</row> <row>113.62.1.1</row> + <row>137.82.0.0</row> + <row>137.82.130.0</row> + <row>151.100.101.92</row> + <row>2003:f6:93bf:26f:9ec7:a6ff:fe29:27df</row> + <row>::ffff:137.82.130.49</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitorId__API.getSuggestedValuesForSegment.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitorId__API.getSuggestedValuesForSegment.xml index e21f421867..8f2deb63ee 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitorId__API.getSuggestedValuesForSegment.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitorId__API.getSuggestedValuesForSegment.xml @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="utf-8" ?> <result> - <row>908c9a564a864265</row> - <row>d0fb963ff976f9c3</row> - <row>b8c37e33defde51c</row> - <row>ffc58105bf6f8a91</row> - <row>a9b7ba70783b617e</row> - <row>1bd69c7df3112fb9</row> - <row>e93028bdc1aacdfb</row> <row>08f90c1a41715536</row> - <row>d806ca13ca3449af</row> - <row>fba9d88164f3e2d9</row> - <row>9246444d94f081e3</row> - <row>d7322ed717dedf1e</row> <row>1587965fb4d4b5af</row> + <row>1bd69c7df3112fb9</row> <row>2387337ba1e0b024</row> - <row>fed33392d3a48aa1</row> + <row>908c9a564a864265</row> + <row>9246444d94f081e3</row> <row>a4380923dd651c19</row> + <row>a9b7ba70783b617e</row> <row>aa68c75c4a77c87f</row> + <row>b8c37e33defde51c</row> + <row>d0fb963ff976f9c3</row> + <row>d7322ed717dedf1e</row> + <row>d806ca13ca3449af</row> + <row>e93028bdc1aacdfb</row> + <row>fba9d88164f3e2d9</row> + <row>fed33392d3a48aa1</row> + <row>ffc58105bf6f8a91</row> <row>e64bc481700c5d69</row> </result>
\ No newline at end of file diff --git a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitorId__VisitsSummary.get_range.xml b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitorId__VisitsSummary.get_range.xml index 1f4bd3c02b..0e04d3f6d9 100644 --- a/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitorId__VisitsSummary.get_range.xml +++ b/plugins/API/tests/System/expected/test_AutoSuggestAPITest_visitorId__VisitsSummary.get_range.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="utf-8" ?> <result> <nb_visits>2</nb_visits> - <nb_actions>5</nb_actions> + <nb_actions>6</nb_actions> <nb_visits_converted>2</nb_visits_converted> <bounce_count>1</bounce_count> <sum_visit_length>1621</sum_visit_length> - <max_actions>4</max_actions> + <max_actions>5</max_actions> <bounce_rate>50%</bounce_rate> - <nb_actions_per_visit>2.5</nb_actions_per_visit> + <nb_actions_per_visit>3</nb_actions_per_visit> <avg_time_on_site>811</avg_time_on_site> </result>
\ No newline at end of file diff --git a/plugins/Actions/VisitorDetails.php b/plugins/Actions/VisitorDetails.php index d6b5ecfff8..941427209f 100644 --- a/plugins/Actions/VisitorDetails.php +++ b/plugins/Actions/VisitorDetails.php @@ -280,7 +280,7 @@ class VisitorDetails extends VisitorDetailsAbstract return strcmp($a['url'], $b['url']); } - return strcmp($b['count'], $a['count']); + return $a['count'] > $b['count'] ? -1 : 1; }); $this->handleSiteSearches($profile); |