Class: Survey::Answer

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

Instance Method Summary collapse

Instance Method Details

#correct?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'app/models/survey/answer.rb', line 24

def correct?
  self.correct ||= self.option.correct?
end

#valueObject



19
20
21
22
# File 'app/models/survey/answer.rb', line 19

def value
  points = (self.option.nil? ? Survey::Option.find(option_id) : self.option).weight
  correct?? points : - points
end