Skip to content

Commit 26e7398

Browse files
committed
Add support for MMRV specific consent link
This amends the consent link generation to include support for MMRV. The only change to the consent journey questions is that we reference MMRV instead of MMR. The link in Notify request includes mmrv in the url (mmrv/start). We then parse this URL to extract programme_types and in the case mmr exists in the type, we set the variant appropriately. This variant is used to create the consent form which is then used throughout the flow to determine what text to show (MMR/MMRV).
1 parent e6506f7 commit 26e7398

12 files changed

Lines changed: 259 additions & 11 deletions

File tree

app/controllers/parent_interface/consent_forms/base_controller.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ def set_programmes
4848
@consent_form.consent_form_programmes.map(&:programme)
4949
elsif @session.present? && params[:programme_types].present?
5050
types = params[:programme_types].split("-")
51-
@session.programmes.select { it.type.in?(types) }
51+
52+
@session.programmes.flat_map do
53+
it.variants.select { it.to_param.in?(types) }
54+
end
5255
end
5356

5457
raise ActiveRecord::RecordNotFound if @programmes.empty?

app/lib/govuk_notify_personalisation.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,19 @@ def consent_deadline
130130
def consent_link
131131
return nil if session.nil? || programmes.empty?
132132

133+
programme_params =
134+
programmes.map do |programme|
135+
if programme.mmr? && patient
136+
programme.variant_for(patient:).to_param
137+
else
138+
programme.to_param
139+
end
140+
end
141+
133142
host +
134143
start_parent_interface_consent_forms_path(
135144
session,
136-
programmes.map(&:to_param).join("-")
145+
programme_params.join("-")
137146
)
138147
end
139148

app/models/programme/variant.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ def initialize(programme, variant_type:)
2727
@variant_type = variant_type
2828
end
2929

30+
def to_param = variant_type
31+
3032
def mmr_variant? = variant_type == "mmr"
3133

3234
def mmrv_variant? = variant_type == "mmrv"

app/views/parent_interface/consent_forms/confirm.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<% programme = consent_form_programme.programme %>
2121

2222
<%= render AppCardComponent.new do |card| %>
23-
<% card.with_heading { t(programme.type, scope: %i[consent_forms confirm consent_card_title]) } %>
23+
<% card.with_heading { t(programme.to_param, scope: %i[consent_forms confirm consent_card_title]) } %>
2424

2525
<%= govuk_summary_list do |summary_list|
2626
summary_list.with_row do |row|

app/views/parent_interface/consent_forms/edit/reason_for_refusal_notes.html.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
<%= h1 t(@consent_form.reason_for_refusal, scope: %i[consent_forms notes title]) %>
99

10-
<% if @consent_form.refused_consent_form_programmes.any? { it.programme.mmr? } && @consent_form.reason_for_refusal == "already_vaccinated" %>
11-
<p class="nhsuk-hint">Children need 2 doses of the MMR vaccine to be fully protected. If your child has had more than 1 dose, give details about both doses.</p>
10+
<% programme = @consent_form.refused_consent_form_programmes.find { it.programme.mmr? }&.programme %>
11+
<% if programme && @consent_form.reason_for_refusal == "already_vaccinated" %>
12+
<p class="nhsuk-hint">Children need 2 doses of the #{programme.name} vaccine to be fully protected. If your child has had more than 1 dose, give details about both doses.</p>
1213
<% end %>
1314

1415
<% label = "Give details" + (@consent_form.reason_for_refusal_requires_notes? ? "" : " (optional)") %>

app/views/parent_interface/consent_forms/edit/response_mmr.html.erb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
<%= govuk_back_link(href: backlink_path) %>
33
<% end %>
44

5-
<% legend = "Do you agree to your child having the MMR vaccination?" %>
5+
<% programme = @consent_form.consent_form_programmes.sole.programme %>
6+
<% legend = "Do you agree to your child having the #{programme.name} vaccination?" %>
67
<% content_for :page_title, legend %>
78

89
<%= form_with model: @consent_form, url: wizard_path, method: :put do |f| %>
910
<%= f.govuk_error_summary %>
1011

1112
<%= f.govuk_radio_buttons_fieldset :response,
1213
legend: { size: "l", text: legend, tag: "h1" },
13-
hint: { text: "This is a catch-up vaccination for those who have not yet had 2 doses of the MMR vaccine. Children usually have these when they are 1 and 3 years old." } do %>
14+
hint: { text: "This is a catch-up vaccination for those who have not yet had 2 doses of the #{programme.name} vaccine. Children usually have these when they are 1 and 3 years old." } do %>
1415
<%= f.govuk_radio_button :response, "given", label: { text: "Yes, I agree" }, link_errors: true %>
1516
<%= f.govuk_radio_button :response, "refused" %>
1617
<% end %>

app/views/parent_interface/consent_forms/edit/without_gelatine.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<%= govuk_back_link(href: backlink_path) %>
33
<% end %>
44

5+
<% programme = @consent_form.consent_form_programmes.sole.programme %>
56
<% legend = "Do you want your child to have a vaccine without gelatine?" %>
67
<% content_for :page_title, legend %>
78

@@ -10,7 +11,7 @@
1011

1112
<%= f.govuk_radio_buttons_fieldset :without_gelatine,
1213
legend: { size: "l", text: legend, tag: "h1" },
13-
hint: { text: "One type of MMR vaccine contains gelatine from pigs. An alternative MMR vaccine is available that does not contain gelatine." } do %>
14+
hint: { text: "One type of #{programme.name} vaccine contains gelatine from pigs. An alternative #{programme.name} vaccine is available that does not contain gelatine." } do %>
1415
<%= f.govuk_radio_button :without_gelatine, :true, label: { text: "I want my child to have the vaccine that does not contain gelatine" }, link_errors: true %>
1516
<%= f.govuk_radio_button :without_gelatine, :false, label: { text: "My child can have either type of vaccine" } %>
1617
<% end %>

app/views/parent_interface/consent_forms/start.html.erb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
<%= h1 t(@programmes.map(&:type).join("-"), scope: %i[consent_forms start title]), size: "xl" %>
1+
<% programme_params = @programmes.map(&:to_param).join("-") %>
2+
<%= h1 t(programme_params, scope: %i[consent_forms start title]), size: "xl" %>
23

34
<% @programmes.each do |programme| %>
4-
<%= render "parent_interface/consent_forms/start/#{programme.type}" %>
5+
<%= render "parent_interface/consent_forms/start/#{programme.to_param}" %>
56
<% end %>
67

78
<h2 class="nhsuk-heading-m">Give or refuse consent</h2>
89

910
<%= form_with url: url_for(action: :create) do |f| %>
1011
<%= hidden_field_tag :session_slug, @session.slug %>
11-
<%= hidden_field_tag :programme_types, @programmes.map(&:type).join("-") %>
12+
<%= hidden_field_tag :programme_types, programme_params %>
1213
<%= f.govuk_submit "Start now", role: "link" %>
1314
<% end %>
1415

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<p>
2+
The MMRV vaccine protects against measles, mumps, rubella and chickenpox
3+
(varicella). Having 2 doses gives lasting protection against all 4 illnesses.
4+
</p>
5+
6+
<p>MMRV has replaced the MMR vaccine, which protects against measles, mumps and rubella.</p>
7+
8+
<p>
9+
If your child has already had 2 doses of the MMR vaccine, they are fully vaccinated and
10+
do not need another dose. Let us know by completing the online form.
11+
</p>
12+
13+
<p>
14+
If your child has not had 2 doses of MMR, they will need an MMRV catch-up vaccination.
15+
If you’re not sure how many doses your child has had, having further doses will not cause
16+
any harm.
17+
</p>
18+
19+
<p>Research has shown there is no link between the MMRV vaccine and autism.</p>
20+
21+
<p>
22+
<%= link_to "Find out more about the MMRV vaccine",
23+
"https://www.nhs.uk/vaccinations/mmrv-vaccine/" %>
24+
</p>

config/locales/en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ en:
605605
hpv: Consent for the HPV vaccination
606606
menacwy: Consent for the MenACWY vaccination
607607
mmr: Consent for the MMR vaccination
608+
mmrv: Consent for the MMRV vaccination
608609
td_ipv: Consent for the Td/IPV vaccination
609610
i_agree: Consent given
610611
notes:
@@ -621,6 +622,7 @@ en:
621622
hpv: Give or refuse consent for the HPV vaccination
622623
menacwy-td_ipv: Give or refuse consent for the MenACWY and Td/IPV vaccinations
623624
mmr: Give or refuse consent for an MMR catch-up vaccination
625+
mmrv: Give or refuse consent for an MMRV catch-up vaccination
624626
dashboard:
625627
index:
626628
title: Home

0 commit comments

Comments
 (0)