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
- #avaliable_for_participant?(participant) ⇒ Boolean
-
#correct_options ⇒ Object
returns all the correct options for current surveys.
-
#incorrect_options ⇒ Object
returns all the incorrect options for current surveys.
Instance Method Details
#available_for_participant?(participant) ⇒ Boolean
37 38 39 40 41 |
# File 'app/models/survey/survey.rb', line 37 def available_for_participant?(participant) current_number_of_attempts = self.attempts.for_participant(participant).size upper_bound = self.attempts_number return !((current_number_of_attempts >= upper_bound) && (upper_bound != 0)) end |
#avaliable_for_participant?(participant) ⇒ Boolean
43 44 45 46 |
# File 'app/models/survey/survey.rb', line 43 def avaliable_for_participant?(participant) warn "[DEPRECATION] avaliable_for_participant? is deprecated. Please use available_for_participant? instead" available_for_participant?(participant) end |
#correct_options ⇒ Object
returns all the correct options for current surveys
28 29 30 |
# File 'app/models/survey/survey.rb', line 28 def return self.questions.map(&:correct_options).flatten end |
#incorrect_options ⇒ Object
returns all the incorrect options for current surveys
33 34 35 |
# File 'app/models/survey/survey.rb', line 33 def return self.questions.map(&:incorrect_options).flatten end |