From 71ba725fd1c03b00eb11723fa3f99165aa6acd19 Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 25 Nov 2020 08:11:28 +0100 Subject: [PATCH] fix: [text export] cull duplicates after fetching the data - pros: No more full group by exceptions Handles duplicate culling across internally paginated workloads - cons: The returned dataset's size will not always match the requested count as duplicates are culled --- app/Lib/Export/TextExport.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Lib/Export/TextExport.php b/app/Lib/Export/TextExport.php index c4a495940..e1da13b9b 100644 --- a/app/Lib/Export/TextExport.php +++ b/app/Lib/Export/TextExport.php @@ -3,21 +3,21 @@ class TextExport { public $additional_params = array( - 'flatten' => 1, - 'group' => 'Attribute.value' + 'flatten' => 1 ); + private $__resultSet = []; + public function handler($data, $options = array()) { if ($options['scope'] === 'Attribute') { - return $data['Attribute']['value']; + $this->__resultSet[$data['Attribute']['value']] = true; } if ($options['scope'] === 'Event') { $result = array(); foreach ($data['Attribute'] as $attribute) { - $result[] = $attribute['value']; + $this->__resultSet[$attribute['value']] = true; } - return implode($this->separator(), $result); } return ''; } @@ -29,11 +29,11 @@ class TextExport public function footer() { - return "\n"; + return implode("\n", array_keys($this->__resultSet)) . "\n"; } public function separator() { - return "\n"; + return ''; } }