Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaijia Feng <fengkaijia@gmail.com>2018-03-12 15:30:24 +0300
committerStefan Giehl <stefan@piwik.org>2018-03-12 15:30:24 +0300
commitd400318f7bd3082f3e1b783c823da2b75e7f8cdb (patch)
tree745f9567994454655323d34d6259625352c49f05 /plugins/UserCountry
parent19435ff30706c3b236bd1a61973d79f364757c23 (diff)
Fix Tibetan cities display on China's city map (#12103)
* Fix Tibetan cities missing from the Chinese city map * Apply the filter without checking every city
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r--plugins/UserCountry/API.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/UserCountry/API.php b/plugins/UserCountry/API.php
index 76acdbb8f1..9fe7cfdcb1 100644
--- a/plugins/UserCountry/API.php
+++ b/plugins/UserCountry/API.php
@@ -160,6 +160,25 @@ class API extends \Piwik\Plugin\API
$separator = Archiver::LOCATION_SEPARATOR;
$unk = Visit::UNKNOWN_CODE;
+
+ // show visits from "1|ti" cities to "14|cn"
+ $dataTables = [$dataTable];
+
+ if ($dataTable instanceof DataTable\Map) {
+ $dataTables = $dataTable->getDataTables();
+ }
+
+ foreach ($dataTables as $dt) {
+ $dt->filter('GroupBy', array(
+ 'label',
+ function ($label) {
+ if (substr($label, -5) == '|1|ti') {
+ return substr($label, 0, -5) . '|14|cn';
+ }
+ return $label;
+ }
+ ));
+ }
// split the label and put the elements into the 'city_name', 'region', 'country',
// 'lat' & 'long' metadata fields