From adaa0e1fcfc5fb49f9ace056fa3c138150bc2ea9 Mon Sep 17 00:00:00 2001 From: Matt Weaver Date: Mon, 22 Jul 2024 11:27:30 -0700 Subject: [PATCH] MODFQMMGR-311 Fix instance statistical codes This commit fixes several small issues with instance statistical codes - The incorrect jsonb_array_elements() was used - The entity type containing stat code names had no ID field. This was causing a NullPointerException in the ResultSetRepository when retrieving column values for stat codes in simple_instance - The stat codes field was not marked as queryable (this was because we previously marked all array-type fields as non-queryable. We'll be making them queryable again as we fix them) - The translation on the stat codes field was incorrect (it was "Statistical code names" which is misleading when there's a "Statistical code name" displayed in the Inventory app which isn't the same field - For now, we'll go with "Statistical code" in order to match the Inventory app (this is based on feedback from BELA, so we'll go ahead and violate our translation guidelines this time) - The field was marked as visibleByDefault, which is incorrect MODFQMMGR-311 Mark the stat code full ID column as an ID This entity type not having any ID columns causes a NullPointerException in the ResultSetRepository when retrieving column values for statistical code names in simple_instance MODFQMMGR-311 Make statistical code names queryable bla --- .../entity-types/inventory/simple_instance.json5 | 8 ++++---- .../simple_inventory_statistical_code_full.json5 | 1 + translations/mod-fqm-manager/en.json | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/resources/entity-types/inventory/simple_instance.json5 b/src/main/resources/entity-types/inventory/simple_instance.json5 index 698f7f18..9c971414 100644 --- a/src/main/resources/entity-types/inventory/simple_instance.json5 +++ b/src/main/resources/entity-types/inventory/simple_instance.json5 @@ -909,13 +909,13 @@ SELECT\ array_agg(elems.value::text)\ FROM\ - jsonb_array_elements(:sourceAlias.jsonb->'statisticalCodeIds') AS elems\ + jsonb_array_elements_text(:sourceAlias.jsonb->'statisticalCodeIds') AS elems\ )", filterValueGetter: "(\ SELECT\ array_agg(lower(elems.value::text))\ FROM\ - jsonb_array_elements(:sourceAlias.jsonb->'statisticalCodeIds') AS elems\ + jsonb_array_elements_text(:sourceAlias.jsonb->'statisticalCodeIds') AS elems\ )", }, { @@ -928,8 +928,8 @@ }, }, idColumnName: 'statistical_code_ids', - queryable: false, - visibleByDefault: true, + queryable: true, + visibleByDefault: false, valueGetter: "( SELECT array_agg(statcode.statistical_code) FILTER (WHERE (statcode.statistical_code) IS NOT NULL) AS array_agg FROM jsonb_array_elements_text((:sourceAlias.jsonb -> 'statisticalCodeIds'::text)) record(value) JOIN drv_inventory_statistical_code_full statcode ON (record.value::text) = statcode.id::text)", source: { entityTypeId: 'd2da8cc7-9171-4d3e-8aba-4da286eb5f1c', diff --git a/src/main/resources/entity-types/inventory/simple_inventory_statistical_code_full.json5 b/src/main/resources/entity-types/inventory/simple_inventory_statistical_code_full.json5 index a5fa841f..4e048a5e 100644 --- a/src/main/resources/entity-types/inventory/simple_inventory_statistical_code_full.json5 +++ b/src/main/resources/entity-types/inventory/simple_inventory_statistical_code_full.json5 @@ -22,6 +22,7 @@ dataType: { dataType: 'rangedUUIDType', }, + isIdColumn: true, visibleByDefault: true, valueGetter: ':sourceAlias.id', }, diff --git a/translations/mod-fqm-manager/en.json b/translations/mod-fqm-manager/en.json index a0285b0f..7a56c8b5 100644 --- a/translations/mod-fqm-manager/en.json +++ b/translations/mod-fqm-manager/en.json @@ -491,7 +491,7 @@ "entityType.simple_item_details.permanent_location_id": "Permanent location UUID", "entityType.simple_item_details.purchase_order_line_identifier": "Purchase order line identifier", "entityType.simple_item_details.statistical_code_ids": "Statistical code UUIDs", - "entityType.simple_item_details.statistical_code_names": "Statistical code names", + "entityType.simple_item_details.statistical_code_names": "Statistical code", "entityType.simple_item_details.status_date": "Status date", "entityType.simple_item_details.status_name": "Status", "entityType.simple_item_details.tags_tag_list": "Tag list",