2525# region_id :integer
2626# managed :boolean default(false), not null
2727# helpdesk_email :string
28+ # add_question_identifiers :boolean default(false), not null
2829#
2930# Foreign Keys
3031#
@@ -118,6 +119,9 @@ class Org < ApplicationRecord
118119
119120 validates :managed , inclusion : { in : BOOLEAN_VALUES ,
120121 message : INCLUSION_MESSAGE }
122+
123+ validates :add_question_identifiers , inclusion : { in : BOOLEAN_VALUES ,
124+ message : INCLUSION_MESSAGE }
121125
122126 validates_property :format , of : :logo , in : LOGO_FORMATS ,
123127 message : _ ( 'must be one of the following formats: ' \
@@ -348,6 +352,12 @@ def merge!(to_be_merged:)
348352 end
349353 # rubocop:enable Metrics/AbcSize
350354
355+ # Verify if org has permission to add Question Identifiers
356+ def can_add_question_identifiers?
357+ add_question_identifiers?
358+ end
359+
360+
351361 private
352362
353363 ##
@@ -372,6 +382,8 @@ def merge_attributes!(to_be_merged:)
372382 self . contact_name = to_be_merged . contact_name unless contact_name . present?
373383 self . feedback_enabled = to_be_merged . feedback_enabled unless feedback_enabled?
374384 self . feedback_msg = to_be_merged . feedback_msg unless feedback_msg . present?
385+ self . add_question_identifiers = true if !add_question_identifiers? && to_be_merged . add_question_identifiers?
386+
375387 end
376388 # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
377389
0 commit comments