Module: SurveyorGui::ReportsHelper

Defined in:
app/helpers/surveyor_gui/reports_helper.rb

Instance Method Summary collapse

Instance Method Details

#question_should_display(q) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/surveyor_gui/reports_helper.rb', line 3

def question_should_display(q)
  display=true
  if q.dependency
    q.dependency.dependency_conditions.each do |dc|
      if Response.where(:question_id => dc.question_id).first && dc.answer_id != Response.where(:question_id => dc.question_id).first.answer_id
        display=false
      end
    end
  end
  return display
end

#star_average(responses, q) ⇒ Object



15
16
17
# File 'app/helpers/surveyor_gui/reports_helper.rb', line 15

def star_average(responses,q)
  (responses.where(:question_id => q.id).where('integer_value > ?',0).collect(&:integer_value).average * 2).round
end