Class: Survey::Survey
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Survey::Survey
- Defined in:
- app/models/survey/survey.rb
Instance Method Summary collapse
- #available_for_participant?(participant) ⇒ Boolean
-
#correct_options ⇒ Object
returns all the correct options for current surveys.
- #description ⇒ Object
-
#incorrect_options ⇒ Object
returns all the incorrect options for current surveys.
- #name ⇒ Object
Instance Method Details
#available_for_participant?(participant) ⇒ Boolean
38 39 40 41 42 43 |
# File 'app/models/survey/survey.rb', line 38 def available_for_participant?(participant) current_number_of_attempts = self.attempts.for_participant(participant).size upper_bound = self.attempts_number not(current_number_of_attempts >= upper_bound and upper_bound != 0) end |
#correct_options ⇒ Object
returns all the correct options for current surveys
29 30 31 |
# File 'app/models/survey/survey.rb', line 29 def Survey::Question.where(:section_id => self.sections.collect(&:id)).map { |question| question. }.flatten end |
#description ⇒ Object
49 50 51 |
# File 'app/models/survey/survey.rb', line 49 def description I18n.locale == I18n.default_locale ? super : locale_description.blank? ? super : locale_description end |
#incorrect_options ⇒ Object
returns all the incorrect options for current surveys
34 35 36 |
# File 'app/models/survey/survey.rb', line 34 def Survey::Question.where(:section_id => self.sections.collect(&:id)).map { |question| question. }.flatten end |
#name ⇒ Object
45 46 47 |
# File 'app/models/survey/survey.rb', line 45 def name I18n.locale == I18n.default_locale ? super : locale_name.blank? ? super : locale_name end |