Skip to content

Commit 373360f

Browse files
committed
Remove contact injection wizard step
The design has changed quite a bit since this was first built and we're going to start refactoring the data model in preparation for the new design. Rather than needing to keep this old design working (which is not being used at all) with the new data model, I think it'll probably be easier to remove this code and then bring it back under the new designs later.
1 parent de8d9f6 commit 373360f

File tree

14 files changed

+19
-222
lines changed

14 files changed

+19
-222
lines changed

app/components/app_consent_confirmation_component.rb

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ class AppConsentConfirmationComponent < ViewComponent::Base
44
erb_template <<-ERB
55
<%= govuk_panel(title_text: title, text: panel_text) %>
66
7-
<% if @consent_form.contact_injection %>
8-
<p>Someone will be in touch to discuss them having an injection instead.</p>
9-
<% end %>
10-
117
<p>We've sent a confirmation to <%= parent_email %></p>
128
ERB
139

@@ -18,20 +14,16 @@ def initialize(consent_form)
1814
end
1915

2016
def title
21-
if @consent_form.contact_injection
22-
"Your child will not get a nasal flu vaccination at school"
17+
case response
18+
when "given"
19+
"Consent confirmed"
20+
when "given_one"
21+
chosen_programme = chosen_programmes.first.name
22+
"Consent for the #{chosen_programme} vaccination confirmed"
23+
when "refused"
24+
"Consent refused"
2325
else
24-
case response
25-
when "given"
26-
"Consent confirmed"
27-
when "given_one"
28-
chosen_programme = chosen_programmes.first.name
29-
"Consent for the #{chosen_programme} vaccination confirmed"
30-
when "refused"
31-
"Consent refused"
32-
else
33-
raise "unrecognised consent response: #{response}"
34-
end
26+
raise "unrecognised consent response: #{response}"
3527
end
3628
end
3729

app/controllers/concerns/consent_form_mailer_concern.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ module ConsentFormMailerConcern
44
extend ActiveSupport::Concern
55

66
def send_consent_form_confirmation(consent_form)
7-
if consent_form.contact_injection?
8-
EmailDeliveryJob.perform_later(
9-
:consent_confirmation_injection,
10-
consent_form:
11-
)
12-
elsif consent_form.consent_refused?
7+
if consent_form.consent_refused?
138
send_consent_form_confirmation_refused(consent_form)
149
else
1510
ProgrammeGrouper

app/controllers/parent_interface/consent_forms/edit_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def update_params
9797
consent: %i[response chosen_vaccine],
9898
reason: %i[reason],
9999
reason_notes: %i[reason_notes],
100-
injection: %i[contact_injection],
101100
address: %i[address_line_1 address_line_2 address_town address_postcode]
102101
}.fetch(current_step)
103102

app/models/consent_form.rb

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# address_town :string
1212
# archived_at :datetime
1313
# chosen_vaccine :string
14-
# contact_injection :boolean
1514
# date_of_birth :date
1615
# education_setting :integer
1716
# family_name :text
@@ -245,10 +244,6 @@ class ConsentForm < ApplicationRecord
245244
validates :reason_notes, presence: true
246245
end
247246

248-
on_wizard_step :injection do
249-
validates :contact_injection, inclusion: { in: [true, false] }
250-
end
251-
252247
on_wizard_step :address do
253248
validates :address_line_1, presence: true
254249
validates :address_town, presence: true
@@ -271,7 +266,6 @@ def wizard_steps
271266
:consent,
272267
(:reason if consent_refused?),
273268
(:reason_notes if consent_refused? && reason_notes_must_be_provided?),
274-
(:injection if injection_offered_as_alternative?),
275269
(:address if consent_given? || consent_given_one?),
276270
(:health_question if consent_given? || consent_given_one?),
277271
(:reason if consent_given_one?),
@@ -499,24 +493,6 @@ def academic_year
499493
created_at.to_date.academic_year
500494
end
501495

502-
def refused_and_not_had_it_already?
503-
consent_refused? && !refused_because_will_be_vaccinated_elsewhere? &&
504-
!refused_because_already_vaccinated?
505-
end
506-
507-
def injection_offered_as_alternative?
508-
refused_and_not_had_it_already? && programmes.any?(&:flu?)
509-
# checking for flu here is a simplification
510-
# the actual logic is: if the parent has refused a nasal vaccine AND the session is for a nasal vaccine
511-
# AND the SAIS organisation offers an alternative injection vaccine, then show the injection step
512-
#
513-
# we currently don't track what type of vaccine was refused.
514-
# currently HPV is only offered as an injection, so we don't need to check for it
515-
#
516-
# so a more true-to-life implementation would be:
517-
# refused_nasal? && not_had_it_already? && injection_offered_as_alternative?
518-
end
519-
520496
def health_answers_valid?
521497
if health_question_number.present?
522498
unless health_answers[health_question_number].valid?
@@ -577,8 +553,6 @@ def reset_unused_fields
577553
self.reason_notes = nil
578554
end
579555

580-
self.contact_injection = nil if consent_given? || consent_given_one?
581-
582556
if school_confirmed
583557
self.education_setting = "school"
584558
self.school = location

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,20 +115,6 @@
115115
href: change_link[:reason],
116116
visually_hidden_text: "reason for refusal")
117117
end
118-
119-
if !@consent_form.contact_injection.nil?
120-
summary_list.with_row do |row|
121-
row.with_key { "Alternative option" }
122-
row.with_value {
123-
@consent_form.contact_injection? ?
124-
"Someone can contact me about an injection" :
125-
"No"
126-
}
127-
row.with_action(text: "Change",
128-
href: change_link[:injection],
129-
visually_hidden_text: "alternative option")
130-
end
131-
end
132118
end
133119
end %>
134120
<% end %>

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

Lines changed: 0 additions & 26 deletions
This file was deleted.

config/initializers/govuk_notify.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
consent_clinic_request: "14e88a09-4281-4257-9574-6afeaeb42715",
55
consent_confirmation_clinic: "f2921e23-4b73-4e44-abbb-38b0e235db8e",
66
consent_confirmation_given: "7cda7ae5-99a2-4c40-9a3e-1863e23f7a73",
7-
consent_confirmation_injection: "4d09483a-8181-4acb-8ba3-7abd6c8644cd",
87
consent_confirmation_refused: "5a676dac-3385-49e4-98c2-fc6b45b5a851",
98
consent_confirmation_triage: "604ee667-c996-471e-b986-79ab98d0767c",
109
consent_school_initial_reminder_doubles:

config/locales/en.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,6 @@ en:
256256
address_town:
257257
blank: Enter a town or city
258258
too_long: Enter a town or city that is less than 300 characters long
259-
contact_injection:
260-
inclusion: Choose if you want to be contacted
261259
date_of_birth:
262260
blank: Enter their date of birth
263261
greater_than_or_equal_to: The child cannot be older than 22. Enter a date after %{count}.
@@ -694,7 +692,6 @@ en:
694692
file_format: file-format
695693
gp: gp
696694
health_question: health-question
697-
injection: injection
698695
location: location
699696
name: name
700697
notes: notes
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
class RemoveContactInjectionFromConsentForms < ActiveRecord::Migration[8.0]
4+
def change
5+
remove_column :consent_forms, :contact_injection, :boolean
6+
end
7+
end

db/schema.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.0].define(version: 2025_05_22_140257) do
13+
ActiveRecord::Schema[8.0].define(version: 2025_06_06_070424) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_catalog.plpgsql"
1616
enable_extension "pg_trgm"
@@ -170,7 +170,6 @@
170170
t.integer "response"
171171
t.integer "reason"
172172
t.text "reason_notes"
173-
t.boolean "contact_injection"
174173
t.string "address_line_1"
175174
t.string "address_line_2"
176175
t.string "address_town"

0 commit comments

Comments
 (0)