Module: ResultsHelper

Defined in:
app/helpers/results_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_response(r_set, question) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/results_helper.rb', line 2

def display_response(r_set,question)
  sets = r_set.responses.select{|r| r.question.display_order == question.display_order}
 	if sets.size == 0
			return "-"
		elsif sets.size == 1
			return (sets.first.string_value || sets.first.text_value || show_answer(sets.first))
		else
		  txt = ""
      sets.each do |set|
        txt << show_answer(set) + "<br/>"
      end
      return txt
  end
end

#show_answer(set) ⇒ Object



17
18
19
# File 'app/helpers/results_helper.rb', line 17

def show_answer(set)
   set.answer.text
end