Skip to content

Commit 96d3b0c

Browse files
authored
Hide refused consent patients from offline export (#2594)
2 parents a2bc746 + fbde8a1 commit 96d3b0c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

app/lib/reports/offline_session_exporter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def add_rows(patient_session:)
153153
style:
154154
)
155155
end
156-
else
156+
elsif !patient_session.consent_refused?
157157
session.programmes.each do |programme|
158158
sheet.add_row(
159159
new_row(

spec/lib/reports/offline_session_exporter_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,14 @@ def worksheet_to_hashes(worksheet)
135135
)
136136
expect(rows.first["PERSON_DOB"].to_date).to eq(patient.date_of_birth)
137137
end
138+
139+
context "with consent refused" do
140+
before { create(:consent, :refused, patient:, programme:) }
141+
142+
it "does not include the row" do
143+
expect(rows.count).to eq(0)
144+
end
145+
end
138146
end
139147

140148
context "with a restricted patient" do
@@ -405,6 +413,14 @@ def worksheet_to_hashes(worksheet)
405413
)
406414
expect(rows.first["PERSON_DOB"].to_date).to eq(patient.date_of_birth)
407415
end
416+
417+
context "with consent refused" do
418+
before { create(:consent, :refused, patient:, programme:) }
419+
420+
it "does not include the row" do
421+
expect(rows.count).to eq(0)
422+
end
423+
end
408424
end
409425

410426
context "with a vaccinated patient" do

0 commit comments

Comments
 (0)