Skip to content

Commit 2b937d5

Browse files
jhendersonbenilovj
authored andcommitted
Use one template for all school consent reminders and subsequent reminders
Previously, HPV, doubles, flu, MMR(V) used separate templates for the first reminder and for second-and-beyond reminders. Those templates had only minor differences, which made them harder to maintain and increased the risk that improvements made to one version would not be applied to the other. This change updates reminder template selection so school consent reminders always use the unified consent_school_reminder_* templates, regardless of whether the reminder is the first one or a later one. Jira-Issue: MAV-2841
1 parent 54cef87 commit 2b937d5

16 files changed

Lines changed: 51 additions & 331 deletions

app/lib/notifier/patient.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
class Notifier::Patient
44
extend ActiveSupport::Concern
55

6+
CONSENT_REMINDER_TYPES = %i[initial_reminder subsequent_reminder].freeze
7+
68
def initialize(patient)
79
@patient = patient
810
end
@@ -246,7 +248,13 @@ def generate_consent_templates(
246248
type:
247249
)
248250
is_school = location.gias_school?
249-
base_template = :"consent_#{is_school ? "school" : "clinic"}_#{type}"
251+
252+
base_template =
253+
if is_school && CONSENT_REMINDER_TYPES.include?(type)
254+
:consent_school_reminder
255+
else
256+
:"consent_#{is_school ? "school" : "clinic"}_#{type}"
257+
end
250258

251259
# We can only handle a single programme group or variant in the template.
252260
group = ProgrammeGrouper.call(programmes).keys.sole

app/models/notify_log_entry.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ class NotifyLogEntry < ApplicationRecord
7777
"38727494-9a81-42b3-9c1f-5c31e55333e7" => :vaccination_administered_menacwy,
7878
"3abe7ca8-a889-484b-ab9f-07523302eb6a" => :vaccination_administered_td_ipv,
7979
"7238ee27-5840-40e5-b9b9-3130ba4cd4fa" => :vaccination_administered_flu,
80-
"0b1095db-fb38-4105-9f01-a364fa8bbb1c" => :vaccination_administered_mmr
80+
"0b1095db-fb38-4105-9f01-a364fa8bbb1c" => :vaccination_administered_mmr,
81+
"ea03aada-0912-4373-91e1-80082071a7aa" =>
82+
:consent_school_subsequent_reminder_doubles,
83+
"c942ce27-590e-4387-9aa8-5b9b4f2796d1" =>
84+
:consent_school_subsequent_reminder_flu,
85+
"5f70d21d-00b6-41e6-bdc9-e64455972b43" =>
86+
:consent_school_subsequent_reminder_hpv
8187
}.freeze
8288

8389
self.inheritance_column = nil

app/views/notify_templates/email/consent_school_initial_reminder_doubles.text.erb renamed to app/views/notify_templates/email/consent_school_reminder_doubles.text.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
template_id: "3523d4b8-530b-42dd-8b9b-7fed8d1dfff1"
3-
template_name: consent_school_initial_reminder_doubles
3+
template_name: consent_school_reminder_doubles
44
subject: "Please respond to our request for consent by <%= consent_deadline %>"
55
---
66
We wrote to you recently to let you know we’re coming to <%= location_name %> on <%= next_session_dates %> to offer your child their <%= vaccination %>.

app/views/notify_templates/email/consent_school_initial_reminder_flu.text.erb renamed to app/views/notify_templates/email/consent_school_reminder_flu.text.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
template_id: "7f85a5b4-5240-4ae9-94f7-43913852943c"
3-
template_name: consent_school_initial_reminder_flu
3+
template_name: consent_school_reminder_flu
44
subject: "Please respond to our request for consent by <%= consent_deadline %>"
55
---
66
We wrote to you recently to let you know we’re coming to <%= location_name %> on <%= next_session_dates %> to offer your child their annual flu vaccination.

app/views/notify_templates/email/consent_school_initial_reminder_hpv.text.erb renamed to app/views/notify_templates/email/consent_school_reminder_hpv.text.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
template_id: "0d78bff0-9dde-4192-8cf8-10e83486b54f"
3-
template_name: consent_school_initial_reminder_hpv
3+
template_name: consent_school_reminder_hpv
44
subject: "Please respond to our request for consent by <%= consent_deadline %>"
55
---
66
We wrote to you recently to let you know we’re coming to <%= location_name %> on <%= next_session_dates %> to offer your child their <%= vaccination %>.

app/views/notify_templates/email/consent_school_initial_reminder_mmr.text.erb renamed to app/views/notify_templates/email/consent_school_reminder_mmr.text.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
template_id: "5462c441-81c0-4ac0-821f-713b4178f8ba"
3-
template_name: consent_school_initial_reminder_mmr
3+
template_name: consent_school_reminder_mmr
44
subject: "Please respond to our request for consent by <%= consent_deadline %>"
55
---
66
We wrote to you recently about MMR catch-up vaccinations at <%= location_name %> on <%= next_session_dates %>.

app/views/notify_templates/email/consent_school_initial_reminder_mmrv.text.erb renamed to app/views/notify_templates/email/consent_school_reminder_mmrv.text.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
template_id: "fe47875a-a0a6-40d9-bd41-a411ebb31cff"
3-
template_name: consent_school_initial_reminder_mmrv
3+
template_name: consent_school_reminder_mmrv
44
subject: "Please respond to our request for consent by <%= consent_deadline %>"
55
---
66
We wrote to you recently about <%= vaccine_and_dose %> catch-up vaccinations at <%= location_name %> on <%= next_session_dates %>.

app/views/notify_templates/email/consent_school_subsequent_reminder_doubles.text.erb

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

app/views/notify_templates/email/consent_school_subsequent_reminder_flu.text.erb

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

app/views/notify_templates/email/consent_school_subsequent_reminder_hpv.text.erb

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

0 commit comments

Comments
 (0)