Skip to content

Commit 39efdea

Browse files
committed
Show MMR 2nd dose delay hint only after 1st dose administered
Previously, the hint text about when the 2nd MMR dose is due was shown even when triaging patients who hadn't received their 1st dose yet. Now, the hint only displays when the patient has already been vaccinated with their 1st dose, making the message contextually relevant and preventing confusion during triage delays for unvaccinated patients.
1 parent 136bc05 commit 39efdea

2 files changed

Lines changed: 35 additions & 5 deletions

File tree

app/components/app_triage_form_component.rb

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ def initialize(form, url:, method: :post, heading: true, continue: false)
1919
def builder = GOVUKDesignSystemFormBuilder::FormBuilder
2020

2121
def hint_text
22-
if programme.mmr? &&
23-
!patient.vaccination_status(
24-
programme:,
25-
academic_year: session.academic_year
26-
).vaccinated?
22+
if programme.mmr? && patient_eligible_for_additional_dose?
2723
"2nd dose is not due until #{form.next_mmr_dose_date.to_fs(:long)}"
2824
else
2925
"For example, #{hint_date.to_fs(:long)} "
@@ -54,4 +50,14 @@ def fieldset_options
5450
{ legend: { text: }, hint: { text: hint } }
5551
end
5652
end
53+
54+
def patient_eligible_for_additional_dose?
55+
next_dose =
56+
patient.vaccination_status(
57+
programme: programme,
58+
academic_year: session.academic_year
59+
).dose_sequence
60+
61+
next_dose == programme.maximum_dose_sequence
62+
end
5763
end

spec/components/app_triage_form_component_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,28 @@
118118
expect(rendered).not_to have_text("The parent has consented to")
119119
end
120120
end
121+
122+
context "hint text for delayed triage when programme is MMR" do
123+
context "when the patient has not received any dose" do
124+
let(:programme) { create(:programme, :mmr) }
125+
126+
it "doesn't show the specific hint text about the 2nd dose" do
127+
expect(rendered).not_to have_text("2nd dose is not due until")
128+
end
129+
end
130+
131+
context "when the patient has received the 1st dose" do
132+
let(:programme) { create(:programme, :mmr) }
133+
134+
before do
135+
create(:vaccination_record, patient:, programme:, session:)
136+
137+
StatusUpdater.call(patient:)
138+
end
139+
140+
it "doesn't show the specific hint text about the 2nd dose" do
141+
expect(rendered).to have_text("2nd dose is not due until")
142+
end
143+
end
144+
end
121145
end

0 commit comments

Comments
 (0)