Class: Survey::Survey

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/survey/survey.rb

Instance Method Summary collapse

Instance Method Details

#available_for_participant?(participant) ⇒ Boolean

Returns:

  • (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

Returns:

  • (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_optionsObject

returns all the correct options for current surveys



28
29
30
# File 'app/models/survey/survey.rb', line 28

def correct_options
  return self.questions.map(&:correct_options).flatten
end

#incorrect_optionsObject

returns all the incorrect options for current surveys



33
34
35
# File 'app/models/survey/survey.rb', line 33

def incorrect_options
  return self.questions.map(&:incorrect_options).flatten
end