|
|
|
@ -2,7 +2,7 @@ class Form::Question
|
|
|
|
|
attr_accessor :id, :header, :hint_text, :description, :questions, |
|
|
|
|
:type, :min, :max, :step, :width, :fields_to_add, :result_field, |
|
|
|
|
:conditional_for, :readonly, :answer_options, :page, :check_answer_label, |
|
|
|
|
:inferred_answers, :hidden_in_check_answers |
|
|
|
|
:inferred_answers, :hidden_in_check_answers, :inferred_check_answers_value |
|
|
|
|
|
|
|
|
|
def initialize(id, hsh, page) |
|
|
|
|
@id = id |
|
|
|
@ -20,6 +20,7 @@ class Form::Question
|
|
|
|
|
@answer_options = hsh["answer_options"] |
|
|
|
|
@conditional_for = hsh["conditional_for"] |
|
|
|
|
@inferred_answers = hsh["inferred_answers"] |
|
|
|
|
@inferred_check_answers_value = hsh["inferred_check_answers_value"] |
|
|
|
|
@hidden_in_check_answers = hsh["hidden_in_check_answers"] |
|
|
|
|
@page = page |
|
|
|
|
end |
|
|
|
@ -54,6 +55,11 @@ class Form::Question
|
|
|
|
|
hidden_in_check_answers |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def has_inferred_check_answers_value?(case_log) |
|
|
|
|
return inferred_check_answers_value["condition"].values[0] == case_log[inferred_check_answers_value["condition"].keys[0]] if inferred_check_answers_value.present? |
|
|
|
|
false |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def update_answer_link_name(case_log) |
|
|
|
|
if type == "checkbox" |
|
|
|
|
answer_options.keys.any? { |key| case_log[key] == "Yes" } ? "Change" : "Answer" |
|
|
|
|