|
|
@ -2,7 +2,7 @@ class Form::Question |
|
|
|
attr_accessor :id, :header, :hint_text, :description, :questions, |
|
|
|
attr_accessor :id, :header, :hint_text, :description, :questions, |
|
|
|
:type, :min, :max, :step, :width, :fields_to_add, :result_field, |
|
|
|
:type, :min, :max, :step, :width, :fields_to_add, :result_field, |
|
|
|
:conditional_for, :readonly, :answer_options, :page, :check_answer_label, |
|
|
|
:conditional_for, :readonly, :answer_options, :page, :check_answer_label, |
|
|
|
:inferred_answers |
|
|
|
:inferred_answers, :hidden_in_check_answers |
|
|
|
|
|
|
|
|
|
|
|
def initialize(id, hsh, page) |
|
|
|
def initialize(id, hsh, page) |
|
|
|
@id = id |
|
|
|
@id = id |
|
|
@ -20,6 +20,7 @@ class Form::Question |
|
|
|
@answer_options = hsh["answer_options"] |
|
|
|
@answer_options = hsh["answer_options"] |
|
|
|
@conditional_for = hsh["conditional_for"] |
|
|
|
@conditional_for = hsh["conditional_for"] |
|
|
|
@inferred_answers = hsh["inferred_answers"] |
|
|
|
@inferred_answers = hsh["inferred_answers"] |
|
|
|
|
|
|
|
@hidden_in_check_answers = hsh["hidden_in_check_answers"] |
|
|
|
@page = page |
|
|
|
@page = page |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -49,6 +50,10 @@ class Form::Question |
|
|
|
conditional_on.map { |condition| evaluate_condition(condition, case_log) }.all? |
|
|
|
conditional_on.map { |condition| evaluate_condition(condition, case_log) }.all? |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def hidden_in_check_answers? |
|
|
|
|
|
|
|
hidden_in_check_answers |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def update_answer_link_name(case_log) |
|
|
|
def update_answer_link_name(case_log) |
|
|
|
if type == "checkbox" |
|
|
|
if type == "checkbox" |
|
|
|
answer_options.keys.any? { |key| case_log[key] == "Yes" } ? "Change" : "Answer" |
|
|
|
answer_options.keys.any? { |key| case_log[key] == "Yes" } ? "Change" : "Answer" |
|
|
|