Skip to content

Commit

Permalink
refs #4633 we should convert a segment value to a segment filter befo…
Browse files Browse the repository at this point in the history
…re queued filters are applied which allows us to use the prependSegment filter in combination with AddSegmentValue
  • Loading branch information
tsteur committed Feb 15, 2015
1 parent c20303e commit 04d330e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
5 changes: 2 additions & 3 deletions core/API/DataTablePostProcessor.php
Expand Up @@ -95,17 +95,16 @@ public function process(DataTableInterface $dataTable)
// we automatically safe decode all datatable labels (against xss)
$dataTable->queueFilter('SafeDecodeLabel');

$dataTable = $this->convertSegmentValueToSegment($dataTable);
$dataTable = $this->applyQueuedFilters($dataTable);
$dataTable = $this->applyRequestedColumnDeletion($dataTable);
$dataTable = $this->applyLabelFilter($dataTable);

$dataTable = $this->applyMetricsFormatting($dataTable);
$dataTable = $this->convertSegmentValueToSegment($dataTable);

return $dataTable;
}

public function convertSegmentValueToSegment(DataTableInterface $dataTable)
private function convertSegmentValueToSegment(DataTableInterface $dataTable)
{
$dataTable->filter('AddSegmentBySegmentValue', array($this->report));
$dataTable->filter('ColumnCallbackDeleteMetadata', array('segmentValue'));
Expand Down
9 changes: 2 additions & 7 deletions plugins/Referrers/API.php
Expand Up @@ -140,13 +140,8 @@ public function getAll($idSite, $period, $date, $segment = false)
public function getKeywords($idSite, $period, $date, $segment = false, $expanded = false)
{
$dataTable = $this->getDataTable(Archiver::KEYWORDS_RECORD_NAME, $idSite, $period, $date, $segment, $expanded);
$dataTable->filter('AddSegmentValue', array(function ($label) {
if ($label === false) {
return false;
}

return $label . ';referrerType==search';
}));
$dataTable->filter('AddSegmentValue');
$dataTable->queueFilter('PrependSegment', array('referrerType==search;'));

$dataTable = $this->handleKeywordNotDefined($dataTable);
return $dataTable;
Expand Down

0 comments on commit 04d330e

Please sign in to comment.