Skip to content

Commit 4572702

Browse files
committed
Change logging of sent submission to be more like logging of submit
Refactor the `submission_sent` event logging so that it is similar to the logging of the `submit` event; add a method for it to the LogEventService, change the event name depending on whether the submission is for a form preview or not, and log the submission type and format.
1 parent 28ce3ef commit 4572702

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

app/jobs/send_submission_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def perform(submission)
1919
)
2020

2121
milliseconds_since_scheduled = (sent_at - scheduled_at_or_enqueued_at).in_milliseconds.round
22-
EventLogger.log_form_event("submission_sent", { milliseconds_since_scheduled: })
22+
EventLogger.log_submission_sent(submission, milliseconds_since_scheduled:)
2323
CloudWatchService.record_submission_sent_metric(milliseconds_since_scheduled)
2424
rescue StandardError
2525
CloudWatchService.record_job_failure_metric(self.class.name)

app/services/log_event_service.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ def self.log_submit(context, requested_email_confirmation:, preview:, submission
2929
end
3030
end
3131

32+
def self.log_submission_sent(submission, **kwargs)
33+
additional_context = {
34+
submission_type: submission.form.submission_type,
35+
submission_format: submission.form.submission_format,
36+
}.merge(kwargs)
37+
38+
if submission.preview?
39+
EventLogger.log_form_event("preview_submission_sent", additional_context)
40+
else
41+
EventLogger.log_form_event("submission_sent", additional_context)
42+
end
43+
end
44+
3245
def log_page_save
3346
EventLogger.log_page_event(log_event, @step.question.question_text, skipped_question?)
3447
if is_starting_form?

0 commit comments

Comments
 (0)