From 4fed4dac6d63936aae4e7092f0a243dfd09e1a1a Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Palmer" Date: Tue, 30 Mar 2021 17:09:09 -0400 Subject: [PATCH] Fix SUPReMM data warehouse export regression (#1520) --- classes/DataWarehouse/Data/BatchDataset.php | 2 +- classes/DataWarehouse/Data/RawStatisticsConfiguration.php | 6 ++++++ .../xdmod/schema/warehouse-export/GET-realms.schema.json | 3 +++ .../integration/lib/Rest/WarehouseExportControllerTest.php | 1 - 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/classes/DataWarehouse/Data/BatchDataset.php b/classes/DataWarehouse/Data/BatchDataset.php index 3682e0cb96..dc266e01ab 100644 --- a/classes/DataWarehouse/Data/BatchDataset.php +++ b/classes/DataWarehouse/Data/BatchDataset.php @@ -202,7 +202,7 @@ private function getNextRow() $row = []; foreach ($this->fields as $field) { - $key = $field['name']; + $key = $field['alias']; $row[] = $field['anonymize'] ? $this->anonymizeField($rawRow[$key]) : $rawRow[$key]; diff --git a/classes/DataWarehouse/Data/RawStatisticsConfiguration.php b/classes/DataWarehouse/Data/RawStatisticsConfiguration.php index 3d89660511..8c53ffc230 100644 --- a/classes/DataWarehouse/Data/RawStatisticsConfiguration.php +++ b/classes/DataWarehouse/Data/RawStatisticsConfiguration.php @@ -187,6 +187,11 @@ public function getBatchExportFieldDefinitions($realm) $fields = []; foreach ($this->getQueryFieldDefinitions($realm) as $field) { + // Skip "ignore" and "analysis" dtype + if (isset($field['dtype']) && in_array($field['dtype'], ['ignore', 'analysis'])) { + continue; + } + $export = isset($field['batchExport']) ? $field['batchExport'] : false; if ($export === false) { continue; @@ -208,6 +213,7 @@ public function getBatchExportFieldDefinitions($realm) $fields[] = [ 'name' => $field['name'], + 'alias' => isset($field['alias']) ? $field['alias'] : $field['name'], 'display' => $display, 'anonymize' => ($export === 'anonymize'), 'documentation' => $field['documentation'] diff --git a/tests/artifacts/xdmod/schema/warehouse-export/GET-realms.schema.json b/tests/artifacts/xdmod/schema/warehouse-export/GET-realms.schema.json index 69a3c68c49..7ed2ce8abf 100644 --- a/tests/artifacts/xdmod/schema/warehouse-export/GET-realms.schema.json +++ b/tests/artifacts/xdmod/schema/warehouse-export/GET-realms.schema.json @@ -51,6 +51,9 @@ "name": { "type": "string" }, + "alias": { + "type": "string" + }, "display": { "type": "string" }, diff --git a/tests/integration/lib/Rest/WarehouseExportControllerTest.php b/tests/integration/lib/Rest/WarehouseExportControllerTest.php index 29a9c0927c..6769c275a5 100644 --- a/tests/integration/lib/Rest/WarehouseExportControllerTest.php +++ b/tests/integration/lib/Rest/WarehouseExportControllerTest.php @@ -396,7 +396,6 @@ public function testDeleteRequests($role, $httpCode, $schema) $ids[] = $datum['id']; } $data = json_encode($ids); - //$this->assertTrue(false, json_encode($beforeContent['data'])); // Delete all existing requests. list($content, $info, $headers) = self::$helpers[$role]->delete('rest/warehouse/export/requests', null, $data);