From c588d1d5c6891e2a3e473610787f12006b12933c Mon Sep 17 00:00:00 2001 From: Simon Tharby Date: Thu, 12 Sep 2024 16:27:01 +0100 Subject: [PATCH] [TAN-2625] Combine 3 queries into one --- back/app/services/project_copy_service.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/back/app/services/project_copy_service.rb b/back/app/services/project_copy_service.rb index 58c2590a8a1f..0394981bd970 100644 --- a/back/app/services/project_copy_service.rb +++ b/back/app/services/project_copy_service.rb @@ -764,10 +764,11 @@ def map_codes(craftjs_json, layout_images_mapping, layout_service = ContentBuild end def project_map_configs - custom_forms = CustomForm.where(participation_context: [@project, *@project.phases]) - custom_fields = CustomField.where(resource: custom_forms) - CustomMaps::MapConfig.where(mappable: @project) - .or(CustomMaps::MapConfig.where(mappable: custom_fields)) + .or( + CustomMaps::MapConfig.where( + mappable: CustomField.where(resource: CustomForm.where(participation_context: [@project, *@project.phases])) + ) + ) end end