Skip to content

Commit

Permalink
Skip further PDS checks for invalidated patients, until invalidation …
Browse files Browse the repository at this point in the history
  • Loading branch information
benilovj committed Oct 18, 2024
1 parent efc1ed3 commit 2c1acf4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/jobs/patient_update_from_pds_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class PatientUpdateFromPDSJob < ApplicationJob
def perform(patient)
raise MissingNHSNumber if patient.nhs_number.nil?

return if patient.invalidated?

pds_patient = PDS::Patient.find(patient.nhs_number)

if pds_patient.nhs_number != patient.nhs_number
Expand Down
9 changes: 9 additions & 0 deletions spec/jobs/patient_update_from_pds_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
end
end

context "invalidated patient" do
let!(:patient) { create(:patient, :invalidated) }

it "doesn't update the patient" do
expect(patient).not_to receive(:update_from_pds!)
perform_now
end
end

context "with an NHS number" do
context "when the patient is valid" do
before do
Expand Down

0 comments on commit 2c1acf4

Please sign in to comment.