Skip to content

Commit

Permalink
fix duplciate email
Browse files Browse the repository at this point in the history
  • Loading branch information
omohokcoj committed Dec 8, 2024
1 parent 79350c8 commit d62d83e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion app/controllers/api/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ def create

submissions.each do |submission|
submission.submitters.each do |submitter|
ProcessSubmitterCompletionJob.perform_async('submitter_id' => submitter.id) if submitter.completed_at?
next unless submitter.completed_at?

ProcessSubmitterCompletionJob.perform_async('submitter_id' => submitter.id, 'send_invitation_email' => false)
end
end

Expand Down
8 changes: 4 additions & 4 deletions app/jobs/process_submitter_completion_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ def perform(params = {})

is_all_completed = !submitter.submission.submitters.exists?(completed_at: nil)

if !is_all_completed && submitter.submission.submitters_order_preserved?
enqueue_next_submitter_request_notification(submitter)
end

Submissions::EnsureResultGenerated.call(submitter)

if is_all_completed && submitter.completed_at == submitter.submission.submitters.maximum(:completed_at)
Expand All @@ -28,6 +24,10 @@ def perform(params = {})

create_completed_documents!(submitter)

if !is_all_completed && submitter.submission.submitters_order_preserved? && params['send_invitation_email'] != false
enqueue_next_submitter_request_notification(submitter)
end

enqueue_completed_webhooks(submitter, is_all_completed:)
end

Expand Down

0 comments on commit d62d83e

Please sign in to comment.