File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,24 +145,17 @@ def reset_team(team)
145145
146146 patients_to_destroy =
147147 find_patients_without_team ( patient_ids_of_not_synced_records )
148- # We need to ensure we only update statuses for patients who are not
149- # destroyed. This should be the same as the list of patients _with_
150- # a team, but it's fine to use this subtraction to be safe.
148+
151149 patient_ids_to_update +=
152150 patient_ids_of_not_synced_records - patients_to_destroy . ids
153151 puts " - Found #{ patients_to_destroy . count } " \
154152 " patient(s) who were in the imports, and no longer have teams"
155153
156- access_log_entries =
157- AccessLogEntry . where ( patient_id : patients_to_destroy . ids )
158- puts " - Found #{ access_log_entries . count } access_log_entries for" \
159- " patients without teams"
160-
161- puts "Destroying access-log-entries..."
162- access_log_entries . destroy_all
163-
164- puts "Destroying patients..."
165- patients_to_destroy . destroy_all
154+ puts "Destroying #{ patients_to_destroy . count } patients..."
155+ PatientDeleter . call (
156+ patients : patients_to_destroy ,
157+ confirm_production_delete : true
158+ )
166159 end
167160
168161 puts "Enqueueing jobs to update statuses for" \
You can’t perform that action at this time.
0 commit comments