Skip to content

Commit da33f46

Browse files
committed
Show notify_parents_on_vaccination on confirmation
If a child self-consents, we ask them if they would like their parents to receive confirmation of their vaccination. Until 4f87a86 we weren't able to show this as it wasn't being stored in the database, but we can now show this information to the users when they view a consent response. Jira-Issue: MAV-1708
1 parent 5acc346 commit da33f46

File tree

6 files changed

+51
-3
lines changed

6 files changed

+51
-3
lines changed

app/components/app_consent_summary_component.rb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,22 @@ def call
5454
end
5555
end
5656

57+
unless consent.notify_parents_on_vaccination.nil?
58+
summary_list.with_row do |row|
59+
row.with_key { "Confirmation of vaccination sent to parent?" }
60+
row.with_value do
61+
consent.notify_parents_on_vaccination ? "Yes" : "No"
62+
end
63+
if (href = change_links[:notify_parents_on_vaccination])
64+
row.with_action(
65+
text: "Change",
66+
visually_hidden_text: "decision",
67+
href:
68+
)
69+
end
70+
end
71+
end
72+
5773
if consent.reason_for_refusal.present?
5874
summary_list.with_row do |row|
5975
row.with_key { "Reason for refusal" }
@@ -63,7 +79,7 @@ def call
6379

6480
unless consent.notify_parent_on_refusal.nil?
6581
summary_list.with_row do |row|
66-
row.with_key { "Confirmation of decision sent to parent" }
82+
row.with_key { "Confirmation of decision sent to parent?" }
6783
row.with_value { consent.notify_parent_on_refusal ? "Yes" : "No" }
6884
end
6985
end

app/views/draft_consents/confirm.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<%= render AppConsentSummaryComponent.new(@draft_consent, change_links: {
1717
response: wizard_path("agree"),
1818
route: wizard_path(@draft_consent.via_self_consent? ? "who" : "route"),
19+
notify_parents_on_vaccination: wizard_path("notify-parents-on-vaccination"),
1920
}) %>
2021
<% end %>
2122

spec/components/app_consent_summary_component_spec.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,30 @@
3535
it { should have_content("Notes") }
3636
end
3737

38+
it { should_not have_content("Confirmation of vaccination sent to parent?") }
39+
40+
context "when the child doesn't want the parents to know about the vaccination" do
41+
let(:consent) { create(:consent, :given, :self_consent) }
42+
43+
it do
44+
expect(rendered).to have_content(
45+
"Confirmation of vaccination sent to parent?\nNo"
46+
)
47+
end
48+
end
49+
50+
context "when the child wants the parents to know about the vaccination" do
51+
let(:consent) do
52+
create(:consent, :given, :self_consent, :notify_parents_on_vaccination)
53+
end
54+
55+
it do
56+
expect(rendered).to have_content(
57+
"Confirmation of vaccination sent to parent?\nYes"
58+
)
59+
end
60+
end
61+
3862
it { should_not have_content("Consent also given for injected vaccine?") }
3963

4064
context "with the flu programme" do

spec/features/self_consent_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ def and_the_child_can_give_their_own_consent_that_the_nurse_records
246246
choose "Child (Gillick competent)"
247247
5.times { click_on "Continue" }
248248

249+
expect(page).to have_content("Confirmation of vaccination sent to parent")
250+
249251
click_on "Confirm"
250252

251253
expect(page).to have_content("Consent recorded for #{@patient.full_name}")

spec/features/verbal_consent_given_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ def record_that_verbal_consent_was_given(
159159
def then_i_see_the_check_and_confirm_page
160160
expect(page).to have_content("Check and confirm answers")
161161
expect(page).to have_content(["Method", "By phone"].join)
162+
expect(page).not_to have_content(
163+
"Confirmation of vaccination sent to parent"
164+
)
162165
end
163166

164167
def and_i_see_the_flu_injection_consent_given

spec/features/verbal_consent_refused_personal_choice_spec.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ def when_i_record_the_consent_refusal_and_reason(notify_parent:)
6565
expect(page).to have_content(["Name", @parent.full_name].join)
6666

6767
if notify_parent
68-
expect(page).to have_content("Confirmation of decision sent to parentYes")
68+
expect(page).to have_content(
69+
"Confirmation of decision sent to parent?Yes"
70+
)
6971
else
70-
expect(page).to have_content("Confirmation of decision sent to parentNo")
72+
expect(page).to have_content("Confirmation of decision sent to parent?No")
7173
end
7274

7375
click_button "Confirm"

0 commit comments

Comments
 (0)