app/models/plan.rb
# The number of answered questions from the entire plan
#
# Returns Integer
The number of answered questions from the entire plan
Returns Integer
The number of answered questions from the entire plan Returns Integer
def num_answered_questions(phase = nil)
    return answers.select(&:answered?).length unless phase.present?
    answered = answers.select do |answer|
      answer.answered? && phase.questions.include?(answer.question)
    end
    answered.length
  end
def num_answered_questions ( phase = nil ) return answers . select ( & :answered? ) . length unless phase . present? answered = answers . select do | answer | answer . answered? && phase . questions . include? ( answer . question ) end answered . length end
The number of answered questions from the entire plan
Returns Integer
The number of answered questions from the entire plan Returns Integer
phase