Skip to content

Commit bf912c5

Browse files
authored
Merge pull request #6434 from NHSDigital/consent-confirmation-no-session
Handle consent confirmation when there is no session
2 parents a03b02b + 65b4cfd commit bf912c5

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

app/models/consent_form.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def session_dates_are_accurate?
437437
# unable to match the consent form to a child, we consider the session
438438
# and therefore the dates to not be accurate enough to display.
439439

440-
original_session_is_accurate? || matched?
440+
original_session_is_accurate? || (session.present? && matched?)
441441
end
442442

443443
def programmes = consent_form_programmes.map(&:programme)

spec/components/app_consent_confirmation_component_spec.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
1616
)
1717
end
1818

19-
context "with Flu programme" do
19+
context "when the consent form has no session" do
20+
let(:team) { create(:team) }
21+
let(:consent_form) { create(:consent_form, original_session: nil) }
22+
23+
it { should have_text("Consent confirmed") }
24+
it { should_not have_text("at school on") }
25+
end
26+
27+
context "with flu programme" do
2028
let(:programme) { Programme.flu }
2129
let(:session) { create(:session, programmes: [programme]) }
2230
let(:consent_form) { create(:consent_form, :given, session:) }

0 commit comments

Comments
 (0)