Class: AskIt::Survey
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AskIt::Survey
- Defined in:
- app/models/ask_it/survey.rb
Instance Method Summary collapse
- #avaliable_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
#avaliable_for_participant?(participant) ⇒ Boolean
41 42 43 44 45 46 |
# File 'app/models/ask_it/survey.rb', line 41 def avaliable_for_participant?(participant) current_number_of_attempts = attempts.for_participant(participant).size upper_bound = attempts_number !(current_number_of_attempts >= upper_bound && upper_bound != 0) end |
#correct_options ⇒ Object
returns all the correct options for current surveys
32 33 34 |
# File 'app/models/ask_it/survey.rb', line 32 def AskIt::Question.where(section_id: section_ids).map(&:correct_options).flatten end |
#description ⇒ Object
56 57 58 59 60 61 62 |
# File 'app/models/ask_it/survey.rb', line 56 def description if I18n.locale == I18n.default_locale super else locale_description.blank? ? super : locale_description end end |
#incorrect_options ⇒ Object
returns all the incorrect options for current surveys
37 38 39 |
# File 'app/models/ask_it/survey.rb', line 37 def AskIt::Question.where(section_id: sections.collect(&:id)).map(&:incorrect_options).flatten end |
#name ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/models/ask_it/survey.rb', line 48 def name if I18n.locale == I18n.default_locale super else locale_name.blank? ? super : locale_name end end |