Skip to content

Commit 791a477

Browse files
authored
Merge pull request #3950 from nhsuk/display-flu-vaccination-method
Add vaccination method to patient search results
2 parents 05a5cc4 + 280f74d commit 791a477

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

app/components/app_patient_session_search_result_card_component.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ class AppPatientSessionSearchResultCardComponent < ViewComponent::Base
2222
row.with_value { action_required }
2323
end
2424
end
25+
26+
if vaccination_method
27+
summary_list.with_row do |row|
28+
row.with_key { "Vaccination method" }
29+
row.with_value { vaccination_method }
30+
end
31+
end
2532
2633
if status_tag
2734
summary_list.with_row do |row|
@@ -106,6 +113,14 @@ def action_required
106113
end
107114
end
108115

116+
def vaccination_method
117+
vaccine_method =
118+
programmes
119+
.flat_map { |programme| patient.approved_vaccine_methods(programme:) }
120+
.first
121+
Vaccine.human_enum_name(:method, vaccine_method).presence
122+
end
123+
109124
def status_tag
110125
return if context == :record
111126

spec/components/app_patient_session_search_result_card_component_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
let(:patient) do
1111
create(
1212
:patient,
13+
:triage_safe_to_vaccinate_nasal,
1314
given_name: "Hari",
1415
family_name: "Seldon",
1516
address_postcode: "SW11 1AA",
1617
year_group: 8,
17-
school: build(:school, name: "Streeling University")
18+
school: build(:school, name: "Streeling University"),
19+
programmes: [programme]
1820
)
1921
end
2022

@@ -30,6 +32,7 @@
3032
it { should have_link("SELDON, Hari", href:) }
3133
it { should have_text("Year 8") }
3234
it { should have_text("Consent status") }
35+
it { should have_text("Nasal") }
3336

3437
context "when patient session has notes" do
3538
let(:note) { create(:note, patient:, session:) }

0 commit comments

Comments
 (0)