Skip to content

Commit

Permalink
Fixes #3361, make sure row evolution works for get[Entry/Exit]PageTit…
Browse files Browse the repository at this point in the history
…les by adding correct label variation for those reports.
  • Loading branch information
diosmosis committed Apr 18, 2013
1 parent 8e95c37 commit 98658d0
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/API/DataTableManipulator/LabelFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,16 @@ protected function manipulateSubtableRequest(&$request)
*/
private function getLabelVariations($label)
{
static $pageTitleReports = array('getPageTitles', 'getEntryPageTitles', 'getExitPageTitles');

$variations = array();
$label = trim($label);

$sanitizedLabel = Piwik_Common::sanitizeInputValue($label);
$variations[] = $sanitizedLabel;

if ($this->apiModule == 'Actions'
&& $this->apiMethod == 'getPageTitles'
&& in_array($this->apiMethod, $pageTitleReports)
) {
// special case: the Actions.getPageTitles report prefixes some labels with a blank.
// the blank might be passed by the user but is removed in Piwik_API_Request::getRequestArrayFromString.
Expand Down
8 changes: 8 additions & 0 deletions tests/PHPUnit/Integration/RowEvolutionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ public function getApiForTesting()
$label = urlencode('incredible title 0') . ',' . urlencode('incredible title 2');
$config['otherRequestParameters']['label'] = urlencode($label);
$return[] = array('API.getRowEvolution', $config);

// standard label, entry page titles
$config['testSuffix'] = '_entryPageTitles';
$config['periods'] = 'day';
$config['otherRequestParameters']['apiModule'] = 'Actions';
$config['otherRequestParameters']['apiAction'] = 'getEntryPageTitles';
$config['otherRequestParameters']['label'] = urlencode('incredible title 0');
$return[] = array('API.getRowEvolution', $config);

// Actions > Page URLS, hierarchical label
$config['testSuffix'] = '_pageUrls';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
<label>incredible title 0</label>
<reportData>
<result date="2010-02-06" />
<result date="2010-02-07">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-02-08" />
<result date="2010-02-09" />
<result date="2010-02-10">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-02-11" />
<result date="2010-02-12" />
<result date="2010-02-13">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-02-14" />
<result date="2010-02-15" />
<result date="2010-02-16">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-02-17" />
<result date="2010-02-18" />
<result date="2010-02-19">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-02-20" />
<result date="2010-02-21" />
<result date="2010-02-22">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-02-23" />
<result date="2010-02-24" />
<result date="2010-02-25">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-02-26" />
<result date="2010-02-27" />
<result date="2010-02-28">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-03-01" />
<result date="2010-03-02" />
<result date="2010-03-03">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
<result date="2010-03-04" />
<result date="2010-03-05" />
<result date="2010-03-06">
<row>
<entry_nb_visits>1</entry_nb_visits>
<entry_bounce_count>1</entry_bounce_count>
<bounce_rate>100%</bounce_rate>
</row>
</result>
</reportData>
<metadata>
<metrics>
<entry_nb_visits>
<name>Entrances</name>
<min>0</min>
<max>1</max>
</entry_nb_visits>
<entry_bounce_count>
<name>Bounces</name>
<min>0</min>
<max>1</max>
</entry_bounce_count>
<bounce_rate>
<name>Bounce Rate</name>
<min>0</min>
<max>100</max>
</bounce_rate>
</metrics>
<dimension>Page Name</dimension>
</metadata>
</result>

0 comments on commit 98658d0

Please sign in to comment.