Skip to content

Commit

Permalink
Update V1Api.php
Browse files Browse the repository at this point in the history
Signed-off-by: Rello <Rello@users.noreply.github.com>
  • Loading branch information
Rello committed Jun 12, 2024
1 parent 6db6e0a commit 26396e1
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions lib/Api/V1Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,30 @@ public function getData(int $nodeId, ?int $limit, ?int $offset, ?string $userId,
}
$data[] = $header;

// now add the rows
foreach ($rows as $row) {
$rowData = $row->getDataArray();
$line = [];
foreach ($columns as $column) {
$value = '';
foreach ($rowData as $datum) {
if ($datum['columnId'] === $column->getId()) {
// if column type selection, the corresponding labels need to be fetched
if ($column->getType() === 'selection') {
foreach ($column->getSelectionOptionsArray() as $option) {
if ($option['id'] === $datum['value']) {
$value = $option['label'];
}
}
} else {
$value = $datum['value'];
}
}
}
$line[] = $value;
}
$data[] = $line;
}
// now add the rows
foreach ($rows as $row) {
$rowData = $row->getDataArray();
$line = [];
foreach ($columns as $column) {
$value = '';
foreach ($rowData as $datum) {
if ($datum['columnId'] === $column->getId()) {
// if column type selection, the corresponding labels need to be fetched
if ($column->getType() === 'selection') {
foreach ($column->getSelectionOptionsArray() as $option) {
if ($option['id'] === $datum['value']) {
$value = $option['label'];
}
}
} else {
$value = $datum['value'];
}
}
}
$line[] = $value;
}
$data[] = $line;
}
return $data;
}
}

0 comments on commit 26396e1

Please sign in to comment.