Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions app/models/immunisation_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class ImmunisationImport < ApplicationRecord
has_and_belongs_to_many :sessions
has_and_belongs_to_many :vaccination_records

after_create :log_started

def type_label
"Vaccination records"
end
Expand Down Expand Up @@ -89,6 +91,7 @@ def process!
post_commit!

update_columns(processed_at: Time.zone.now, status: :processed, **counts)
log_finished
end

private
Expand Down Expand Up @@ -190,4 +193,22 @@ def post_commit!

TeamCachedCounts.new(team).reset_import_issues!
end

def log_started
with_logger_tags { logger.info("started") }
end

def log_finished
with_logger_tags do
logger.info(
"finished",
duration_ms: ((processed_at - created_at) * 1000).to_i,
count: rows_count
)
end
end

def with_logger_tags(&)
SemanticLogger.tagged(id:, team_workgroup: team.workgroup, &)
end
end
Loading