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

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

Loading…
Cancel
Save