Skip to content

Commit

Permalink
Reporting: Fixed error when filter by tag is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mgbaybay committed Aug 1, 2024
1 parent 3093339 commit 73fd924
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/Report/TimeDisconnectedSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ public function getResults(SanitizerInterface $sanitizedParams)
$displayBody .= 'AND display.displayId IN (' . implode(',', $displayIds) . ') ';
}

$tagParams = [];

if ($tags != '') {
if (trim($tags) === '--no-tag') {
$displayBody .= ' AND `displaygroup`.displaygroupId NOT IN (
Expand Down Expand Up @@ -393,9 +395,9 @@ public function getResults(SanitizerInterface $sanitizedParams)
}

if ($operator === '=') {
$params['tags' . $i] = $tag;
$tagParams['tags' . $i] = $tag;
} else {
$params['tags' . $i] = '%' . $tag . '%';
$tagParams['tags' . $i] = '%' . $tag . '%';
}
}

Expand All @@ -411,7 +413,7 @@ public function getResults(SanitizerInterface $sanitizedParams)
GROUP BY display.display, display.displayId
';

if ($groupBy === 'displayGroup') {
if ($tags != '' || $groupBy === 'displayGroup') {
$displayBody .= ', displaygroup.displayGroupId ';
}

Expand All @@ -428,7 +430,7 @@ public function getResults(SanitizerInterface $sanitizedParams)
$rows = [];

// Retrieve the disconnected/connected time from the $disconnectedDisplays array into displays
foreach ($this->store->select($displaySql, []) as $displayRow) {
foreach ($this->store->select($displaySql, $tagParams) as $displayRow) {
$sanitizedDisplayRow = $this->sanitizer->getSanitizer($displayRow);
$entry = [];
$displayId = $sanitizedDisplayRow->getInt(('displayId'));
Expand Down

0 comments on commit 73fd924

Please sign in to comment.