rubocop fixes

pull/544/head
Ryan Arakawa 4 months ago
parent 5fe00d3206
commit 07f92058f0

@ -67,8 +67,8 @@ class Submitter < ApplicationRecord
scope :completed, -> { where.not(completed_at: nil) }
after_destroy :anonymize_email_events, if: -> { Docuseal.multitenant? }
after_update :export_submission_on_status_change
after_destroy :anonymize_email_events, if: -> { Docuseal.multitenant? }
def status
if declined_at?
@ -126,10 +126,10 @@ class Submitter < ApplicationRecord
def export_submission_on_status_change
status_fields = %w[completed_at declined_at opened_at sent_at]
return unless (saved_changes.keys & status_fields).any?
return unless saved_changes.keys.intersect?(status_fields)
ExportSubmissionService.new(submission).call
rescue => e
rescue StandardError => e
Rails.logger.error("Failed to export submission on status change: #{e.message}")
end
end

@ -65,11 +65,11 @@ class ExportSubmissionService < ExportService
if statuses.include?('declined')
'declined'
elsif statuses.all? { |s| s == 'completed' }
elsif statuses.all?('completed')
'completed'
elsif statuses.any? { |s| s == 'opened' }
elsif statuses.any?('opened')
'in_progress'
elsif statuses.any? { |s| s == 'sent' }
elsif statuses.any?('sent')
'sent'
else
'pending'

Loading…
Cancel
Save