class CommitPatientChangesetsJob
Public Instance Methods
Source
# File app/jobs/commit_patient_changesets_job.rb, line 21 def perform(patient_changeset_ids) changesets = PatientChangeset.includes(:patient).where(id: patient_changeset_ids) import = changesets.first.import counts = import.count_columns.index_with { |col| import.public_send(col) || 0 } ActiveRecord::Base.transaction do # Reset patient_ids to avoid stale associations changesets.update_all(patient_id: nil) to_skip, to_process = changesets .select { review_consistent?(it) } .partition(&:skipped_school_move?) if to_process.any? increment_column_counts!(import, counts, to_process) import_patients_and_parents(to_process, import) import_school_moves(to_process, import) import_pds_search_results(to_process, import) to_process.each(&:processed!) end to_skip.each(&:processed!) PatientTeamUpdater.call(patient_scope: import.patients) end if finished_committing_changesets?(import) run_post_commit_tasks(import, counts) end import.post_commit! end