Skip to content

Commit 7068a7c

Browse files
committed
Stop updating Patient::VaccinationStatus
We're no longer using this model anywhere so we can safely stop updating it. Jira-Issue: MAV-2660
1 parent 51b629e commit 7068a7c

2 files changed

Lines changed: 0 additions & 62 deletions

File tree

app/lib/status_updater.rb

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def call
1111
update_programme_statuses!
1212
update_registration_statuses!
1313
update_triage_statuses!
14-
update_vaccination_statuses!
1514
end
1615

1716
def self.call(...) = new(...).call
@@ -134,43 +133,6 @@ def update_triage_statuses!
134133
end
135134
end
136135

137-
def update_vaccination_statuses!
138-
Patient::VaccinationStatus.import!(
139-
%i[patient_id programme_type academic_year],
140-
patient_statuses_to_import,
141-
on_duplicate_key_ignore: true
142-
)
143-
144-
Patient::VaccinationStatus
145-
.then { patient ? it.where(patient:) : it }
146-
.where(academic_year: academic_years)
147-
.includes(
148-
:attendance_record,
149-
:consents,
150-
:patient,
151-
:patient_locations,
152-
:triages,
153-
:vaccination_records
154-
)
155-
.find_in_batches(batch_size: 10_000) do |batch|
156-
batch.each(&:assign_status)
157-
158-
Patient::VaccinationStatus.import!(
159-
batch.select(&:changed?),
160-
on_duplicate_key_update: {
161-
conflict_target: [:id],
162-
columns: %i[
163-
dose_sequence
164-
latest_date
165-
latest_location_id
166-
latest_session_status
167-
status
168-
]
169-
}
170-
)
171-
end
172-
end
173-
174136
def patient_statuses_to_import
175137
@patient_statuses_to_import ||=
176138
Patient

spec/lib/status_updater_spec.rb

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@
2929
it "doesn't create any triage statuses" do
3030
expect { call }.not_to change(Patient::TriageStatus, :count)
3131
end
32-
33-
it "doesn't create any vaccination statuses" do
34-
expect { call }.not_to change(Patient::VaccinationStatus, :count)
35-
end
3632
end
3733

3834
context "with an flu session and eligible patient" do
@@ -66,11 +62,6 @@
6662
expect { call }.to change(patient.triage_statuses, :count).by(1)
6763
expect(patient.triage_statuses.first).to be_not_required
6864
end
69-
70-
it "creates a vaccination status" do
71-
expect { call }.to change(Patient::VaccinationStatus, :count).by(1)
72-
expect(Patient::VaccinationStatus.first).to be_eligible
73-
end
7465
end
7566

7667
context "with an HPV session and eligible patient" do
@@ -95,11 +86,6 @@
9586
expect { call }.to change(patient.triage_statuses, :count).by(1)
9687
expect(patient.triage_statuses.first).to be_not_required
9788
end
98-
99-
it "creates a vaccination status" do
100-
expect { call }.to change(Patient::VaccinationStatus, :count).by(1)
101-
expect(Patient::VaccinationStatus.first).to be_eligible
102-
end
10389
end
10490

10591
context "with a doubles session and ineligible patient" do
@@ -121,10 +107,6 @@
121107
it "doesn't create any triage statuses" do
122108
expect { call }.not_to change(Patient::TriageStatus, :count)
123109
end
124-
125-
it "doesn't create any vaccination statuses" do
126-
expect { call }.not_to change(Patient::VaccinationStatus, :count)
127-
end
128110
end
129111

130112
context "with an doubles session and eligible patient" do
@@ -151,11 +133,5 @@
151133
expect(patient.triage_statuses.first).to be_not_required
152134
expect(patient.triage_statuses.second).to be_not_required
153135
end
154-
155-
it "creates a patient vaccination status for both programmes" do
156-
expect { call }.to change(Patient::VaccinationStatus, :count).by(2)
157-
expect(Patient::VaccinationStatus.first).to be_eligible
158-
expect(Patient::VaccinationStatus.second).to be_eligible
159-
end
160136
end
161137
end

0 commit comments

Comments
 (0)