From aa5ca2fb43567da66b641932df7cc8b581ea79b7 Mon Sep 17 00:00:00 2001 From: John Henderson Date: Fri, 17 Apr 2026 17:34:59 +0100 Subject: [PATCH] Fix consent period copy on the day consent closes This fixes a bug where the session overview was showing consent as already closed on the day before the last session date, even though parents could still submit consent until midnight. Jira-Issue: MAV-6547 --- app/helpers/sessions_helper.rb | 2 ++ spec/helpers/sessions_helper_spec.rb | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb index b6edeea650..b686107f77 100644 --- a/app/helpers/sessions_helper.rb +++ b/app/helpers/sessions_helper.rb @@ -9,6 +9,8 @@ def session_consent_period(session) "Not provided" elsif open_at.future? "Opens #{open_at.to_fs(:short)}" + elsif close_at.today? + "Closes today at midnight" elsif close_at.future? "Open from #{open_at.to_fs(:short)} until #{close_at.to_fs(:short)}" else diff --git a/spec/helpers/sessions_helper_spec.rb b/spec/helpers/sessions_helper_spec.rb index 42257ad86c..ee04473ad0 100644 --- a/spec/helpers/sessions_helper_spec.rb +++ b/spec/helpers/sessions_helper_spec.rb @@ -23,6 +23,12 @@ it { should eq("Open from 23 September until 13 October") } end + context "when the consent period closes today" do + let(:date) { Date.new(2024, 10, 2) } + + it { should eq("Closes today at midnight") } + end + context "when in the far future" do let(:date) { Date.new(2025, 1, 1) }