Skip to content

Commit 478a96b

Browse files
authored
Merge pull request #3906 from nhsuk/has-multiple-dates-personalisation
2 parents fdea34e + 6fe2a1f commit 478a96b

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
@@ -40,6 +40,7 @@ def to_h
4040
consent_link:,
4141
day_month_year_of_vaccination:,
4242
full_and_preferred_patient_name:,
43+
has_multiple_dates:,
4344
location_name:,
4445
next_or_today_session_date:,
4546
next_or_today_session_dates:,
@@ -132,6 +133,16 @@ def full_and_preferred_patient_name
132133
(consent_form || patient).full_name_with_known_as(context: :parents)
133134
end
134135

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

spec/lib/govuk_notify_personalisation_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
consent_link:
5656
"http://localhost:4000/consents/#{session.slug}/hpv/start",
5757
full_and_preferred_patient_name: "John Smith",
58+
has_multiple_dates: "no",
5859
location_name: "Hogwarts",
5960
next_or_today_session_date: "Thursday 1 January",
6061
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)