Class: Helena::QuestionGroup

Inherits:
Object
  • Object
show all
Includes:
Concerns::ApplicationModel, Mongoid::Orderable
Defined in:
app/models/helena/question_group.rb

Instance Method Summary collapse

Instance Method Details

#question_codesObject



15
16
17
# File 'app/models/helena/question_group.rb', line 15

def question_codes
  questions.map { |question| [question.code] + question.sub_questions.map(&:code) }.flatten
end

#question_textsObject



19
20
21
# File 'app/models/helena/question_group.rb', line 19

def question_texts
  questions.map { |question| [question.code, question.question_text] + subquestion_texts(question) }.flatten
end

#subquestion_texts(question) ⇒ Object



23
24
25
# File 'app/models/helena/question_group.rb', line 23

def subquestion_texts(question)
  question.sub_questions.map { |sub_question| [sub_question.code, sub_question.text] }
end