Class: Effective::Response

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

Instance Method Summary collapse

Instance Method Details

#category_partialObject



77
78
79
# File 'app/models/effective/response.rb', line 77

def category_partial
  question&.category_partial
end

#completed?Boolean

Returns:

  • (Boolean)


81
82
83
84
# File 'app/models/effective/response.rb', line 81

def completed?
  return false if responsable.blank?
  responsable.completed?
end

#responseObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/models/effective/response.rb', line 60

def response
  return nil unless question.present?

  return date if question.date?
  return email if question.email?
  return number if question.number?
  return long_answer if question.long_answer?
  return short_answer if question.short_answer?
  return upload_file if question.upload_file?

  return question_options.first if question.choose_one?
  return question_options.first if question.select_up_to_1?
  return question_options if question.question_option?

  raise('unknown response for unexpected question category')
end

#to_sObject



55
56
57
58
# File 'app/models/effective/response.rb', line 55

def to_s
  #model_name.human
  response.to_s
end