Skip to content

Commit 6fe2a1f

Browse files
committed
Add has_multiple_dates personalisation variable
This is a variable that will be passed to GOV.UK Notify and will be used to customise the content shown in a number of emails according to whether the session has lots of dates or not. Jira-Issue: MAV-1277 Jira-Issue: MAV-1527
1 parent 8da8412 commit 6fe2a1f

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

app/lib/govuk_notify_personalisation.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def to_h
4444
consent_link:,
4545
day_month_year_of_vaccination:,
4646
full_and_preferred_patient_name:,
47+
has_multiple_dates:,
4748
location_name:,
4849
next_or_today_session_date:,
4950
next_or_today_session_dates:,
@@ -134,6 +135,16 @@ def full_and_preferred_patient_name
134135
(consent_form || patient).full_name_with_known_as(context: :parents)
135136
end
136137

138+
def has_multiple_dates
139+
return nil if session.nil?
140+
141+
if session.today_or_future_dates.length > 1
142+
"yes"
143+
else
144+
"no"
145+
end
146+
end
147+
137148
def host
138149
if Rails.env.local?
139150
"http://localhost:4000"

spec/lib/govuk_notify_personalisation_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
consent_link:
5858
"http://localhost:4000/consents/#{session.slug}/hpv/start",
5959
full_and_preferred_patient_name: "John Smith",
60+
has_multiple_dates: "no",
6061
location_name: "Hogwarts",
6162
next_or_today_session_date: "Thursday 1 January",
6263
next_or_today_session_dates: "Thursday 1 January",
@@ -128,6 +129,7 @@
128129
expect(to_h).to match(
129130
hash_including(
130131
consent_deadline: "Wednesday 31 December",
132+
has_multiple_dates: "yes",
131133
next_or_today_session_date: "Thursday 1 January",
132134
next_or_today_session_dates:
133135
"Thursday 1 January and Friday 2 January",

0 commit comments

Comments
 (0)