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:
-rw-r--r--plugins/API/API.php7
-rwxr-xr-xtests/PHPUnit/Integration/RowEvolutionTest.php15
2 files changed, 20 insertions, 2 deletions
diff --git a/plugins/API/API.php b/plugins/API/API.php
index 8bceb2cbe6..23cf814768 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -1197,7 +1197,7 @@ class Piwik_API_API
}
}
- if (count($labels) > 1) {
+ if (count($labels) != 1) {
$data = $this->getMultiRowEvolution(
$dataTable,
$idSite,
@@ -1538,7 +1538,10 @@ class Piwik_API_API
}
$newTable = $table->getEmptyClone();
- $newTable->addRow($newRow);
+ if (!empty($labels)) { // only add a row if the row has data (no labels === no data)
+ $newTable->addRow($newRow);
+ }
+
$dataTableMulti->addTable($newTable, $tableLabel);
}
diff --git a/tests/PHPUnit/Integration/RowEvolutionTest.php b/tests/PHPUnit/Integration/RowEvolutionTest.php
index 964cad67f7..7ef6d849d3 100755
--- a/tests/PHPUnit/Integration/RowEvolutionTest.php
+++ b/tests/PHPUnit/Integration/RowEvolutionTest.php
@@ -171,6 +171,21 @@ class Test_Piwik_Integration_RowEvolution extends IntegrationTestCase
)
));
+ // test multi row evolution when there is no data
+ $return[] = array('API.getRowEvolution', array(
+ 'testSuffix' => '_multiWithNoData',
+ 'periods' => 'day',
+ 'idSite' => $idSite,
+ 'date' => $today,
+ 'otherRequestParameters' => array(
+ 'date' => '2010-04-01,2010-04-06',
+ 'period' => 'day',
+ 'apiModule' => 'Referers',
+ 'apiAction' => 'getWebsites',
+ // no label
+ )
+ ));
+
// (non-rowevolution test) test flattener w/ search engines to make sure
// queued filters are not applied twice
$return[] = array('Referers.getSearchEngines', array(