From efbb0d7240421f7693e64df76192ac61dfabebc2 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Wed, 22 Jun 2022 17:21:36 +0100 Subject: [PATCH] Fix performance by not looping through answer options from DB unnecessarily --- app/models/form/setup/questions/created_by_id.rb | 6 ++++++ app/models/form/setup/questions/owning_organisation_id.rb | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/app/models/form/setup/questions/created_by_id.rb b/app/models/form/setup/questions/created_by_id.rb index e01ae01c9..eee7d9485 100644 --- a/app/models/form/setup/questions/created_by_id.rb +++ b/app/models/form/setup/questions/created_by_id.rb @@ -39,4 +39,10 @@ class Form::Setup::Questions::CreatedById < ::Form::Question def derived? true end + +private + + def selected_answer_option_is_derived?(_case_log) + false + end end diff --git a/app/models/form/setup/questions/owning_organisation_id.rb b/app/models/form/setup/questions/owning_organisation_id.rb index ec48a4303..6b573e109 100644 --- a/app/models/form/setup/questions/owning_organisation_id.rb +++ b/app/models/form/setup/questions/owning_organisation_id.rb @@ -39,4 +39,10 @@ class Form::Setup::Questions::OwningOrganisationId < ::Form::Question def derived? true end + +private + + def selected_answer_option_is_derived?(_case_log) + false + end end