File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ class ImmunisationImport < ApplicationRecord
4444 has_and_belongs_to_many :sessions
4545 has_and_belongs_to_many :vaccination_records
4646
47+ after_create :log_started
48+
4749 def type_label
4850 "Vaccination records"
4951 end
@@ -89,6 +91,7 @@ def process!
8991 post_commit!
9092
9193 update_columns ( processed_at : Time . zone . now , status : :processed , **counts )
94+ log_finished
9295 end
9396
9497 private
@@ -224,4 +227,18 @@ def post_commit!
224227
225228 TeamCachedCounts . new ( team ) . reset_import_issues!
226229 end
230+
231+ def log_started
232+ with_logger_tags { logger . info ( "started" , started_at : created_at ) }
233+ end
234+
235+ def log_finished
236+ with_logger_tags do
237+ logger . info ( "finished" , finished_at : processed_at , row_count : rows . count )
238+ end
239+ end
240+
241+ def with_logger_tags ( &)
242+ SemanticLogger . tagged ( import_class : model_name . to_s , import_id : id , &)
243+ end
227244end
You can’t perform that action at this time.
0 commit comments