Class: Effective::CpdAuditResponse

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

Instance Method Summary collapse

Instance Method Details

#category_partialObject



83
84
85
# File 'app/models/effective/cpd_audit_response.rb', line 83

def category_partial
  cpd_audit_level_question&.category_partial
end

#responseObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'app/models/effective/cpd_audit_response.rb', line 66

def response
  return nil unless cpd_audit_level_question.present?

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

  return cpd_audit_level_question_options.first if cpd_audit_level_question.choose_one?
  return cpd_audit_level_question_options.first if cpd_audit_level_question.select_up_to_1?
  return cpd_audit_level_question_options if cpd_audit_level_question.question_option?

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

#to_sObject



62
63
64
# File 'app/models/effective/cpd_audit_response.rb', line 62

def to_s
  model_name.human
end