Class: FormSubmissionAttempt

Inherits:
ApplicationRecord show all
Includes:
AASM
Defined in:
app/models/form_submission_attempt.rb

Instance Method Summary collapse

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Instance Method Details

#log_status_changeObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/form_submission_attempt.rb', line 34

def log_status_change
  log_hash = {
    form_submission_id:,
    benefits_intake_uuid: form_submission&.benefits_intake_uuid,
    form_type: form_submission&.form_type,
    from_state: aasm.from_state,
    to_state: aasm.to_state,
    event: aasm.current_event
  }
  if failure?
    log_hash[:message] = 'Form Submission Attempt failed'
    Rails.logger.error(log_hash)
  elsif vbms?
    log_hash[:message] = 'Form Submission Attempt went to vbms'
    Rails.logger.info(log_hash)
  else
    log_hash[:message] = 'Form Submission Attempt State change'
    Rails.logger.info(log_hash)
  end
end