From c428a526d2082c16f50c6c37db0b44f8e7dc37bf Mon Sep 17 00:00:00 2001 From: Camden Mecklem Date: Tue, 20 Feb 2024 14:47:54 -0500 Subject: [PATCH 1/2] fix indexing for case where user_defined field is nil --- app/services/core_data_connector/search/base.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/core_data_connector/search/base.rb b/app/services/core_data_connector/search/base.rb index fdca1a3..53e08bf 100644 --- a/app/services/core_data_connector/search/base.rb +++ b/app/services/core_data_connector/search/base.rb @@ -373,6 +373,8 @@ def build_user_defined(record, user_defined_fields) hash = {} user_defined_fields.each do |field| + next unless record.user_defined + value = record.user_defined[field.uuid] next unless value.present? From 3d940f3022fb1426ca5c61a60cf118cca9f171cd Mon Sep 17 00:00:00 2001 From: Camden Mecklem Date: Tue, 20 Feb 2024 14:58:57 -0500 Subject: [PATCH 2/2] add null check to public endpoint too --- .../core_data_connector/public/user_defined_serializer.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/serializers/core_data_connector/public/user_defined_serializer.rb b/app/serializers/core_data_connector/public/user_defined_serializer.rb index 83e08f9..d4a7f5a 100644 --- a/app/serializers/core_data_connector/public/user_defined_serializer.rb +++ b/app/serializers/core_data_connector/public/user_defined_serializer.rb @@ -29,6 +29,8 @@ def render_user_defined(item, fields, hash) return if fields.nil? fields.each do |field| + next unless item.user_defined + value = item.user_defined[field.uuid] next if value.nil? @@ -40,4 +42,4 @@ def render_user_defined(item, fields, hash) end end end -end \ No newline at end of file +end