Skip to content

Commit

Permalink
Fix headers in flat list aggregations
Browse files Browse the repository at this point in the history
Fixes #678
  • Loading branch information
annda committed Nov 1, 2023
1 parent 5827d73 commit 62c804c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions meta/AggregationList.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,16 @@ protected function renderNode(NestedValue $node)
*/
protected function renderListItem($resultrow, $depth, $showEmpty = false)
{
$sepbyheaders = $this->searchConfig->getConf()['sepbyheaders'];
$headers = $this->searchConfig->getConf()['headers'];
$config = $this->searchConfig->getConf();
$sepbyheaders = $config['sepbyheaders'];
$headers = $config['headers'];

foreach ($resultrow as $index => $value) {
$column = $index + $depth; // the resultrow is shifted by the nesting depth
// when nesting, the resultrow is shifted by the nesting depth
$column = $index;
if ($config['nesting']) {
$column += $depth;
}
if ($sepbyheaders && !empty($headers[$column])) {
$header = $headers[$column];
} else {
Expand Down
6 changes: 3 additions & 3 deletions meta/ConfigParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,14 @@ protected function parseValues($line)
$value = '';
$len = strlen($line);
for ($i = 0; $i < $len; $i++) {
if ($line[$i] == '"') {
if ($line[$i] === '"') {
if ($inQuote) {
if ($escapedQuote) {
$value .= '"';
$escapedQuote = false;
continue;
}
if ($line[$i + 1] == '"') {
if (isset($line[$i + 1]) && $line[$i + 1] === '"') {
$escapedQuote = true;
continue;
}
Expand All @@ -299,7 +299,7 @@ protected function parseValues($line)
$value = ''; //don't store stuff before the opening quote
continue;
}
} elseif ($line[$i] == ',') {
} elseif ($line[$i] === ',') {
if ($inQuote) {
$value .= ',';
continue;
Expand Down

1 comment on commit 62c804c

@splitbrain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@annda could we have a unit test for this?

Please sign in to comment.