From 20f4bf69b64ea2aeb2583ba3e6fd96347e8f5b5b Mon Sep 17 00:00:00 2001 From: Stefanni Brasil Date: Wed, 20 May 2026 17:07:07 -0600 Subject: [PATCH 1/4] Improve Availability date on annual report The annual report shows a number of months until the current year's report is available. It's confusing because it shows the availability in months. In December, for example, it says it is 0 months until the report is available. We want to instead display the date when the report will be available -- which is the first day of the following year, i.e., January 1, 2027. --- app/helpers/reports/annual_reports_helper.rb | 7 +++++++ app/views/reports/annual_reports/index.html.erb | 2 +- spec/helpers/reports/annual_reports_helper_spec.rb | 9 +++++++++ spec/requests/reports/annual_reports_requests_spec.rb | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 app/helpers/reports/annual_reports_helper.rb create mode 100644 spec/helpers/reports/annual_reports_helper_spec.rb diff --git a/app/helpers/reports/annual_reports_helper.rb b/app/helpers/reports/annual_reports_helper.rb new file mode 100644 index 0000000000..23403c4842 --- /dev/null +++ b/app/helpers/reports/annual_reports_helper.rb @@ -0,0 +1,7 @@ +module Reports + module AnnualReportsHelper + def available_date + (Date.current + 1.year).beginning_of_year.strftime("%B%e, %Y") + end + end +end diff --git a/app/views/reports/annual_reports/index.html.erb b/app/views/reports/annual_reports/index.html.erb index fbfffdfdb3..894bbf4625 100644 --- a/app/views/reports/annual_reports/index.html.erb +++ b/app/views/reports/annual_reports/index.html.erb @@ -25,7 +25,7 @@
Reports are available at the end of every year.
- <%= "#{@actual_year} (available in #{pluralize(@month_remaining_to_report, 'month')})" %> + <%= "#{@actual_year} (available in #{available_date})" %>
diff --git a/spec/helpers/reports/annual_reports_helper_spec.rb b/spec/helpers/reports/annual_reports_helper_spec.rb new file mode 100644 index 0000000000..3108132bc5 --- /dev/null +++ b/spec/helpers/reports/annual_reports_helper_spec.rb @@ -0,0 +1,9 @@ +RSpec.describe Reports::AnnualReportsHelper, type: :helper do + describe "#available_date" do + it "returns the first day of the following year with a custom date format" do + travel_to Time.zone.local(2026, 0o1, 0o1) + + expect(helper.available_date).to eq("January 1, 2027") + end + end +end diff --git a/spec/requests/reports/annual_reports_requests_spec.rb b/spec/requests/reports/annual_reports_requests_spec.rb index c6229428b5..af0fb2570f 100644 --- a/spec/requests/reports/annual_reports_requests_spec.rb +++ b/spec/requests/reports/annual_reports_requests_spec.rb @@ -17,6 +17,12 @@ get reports_annual_reports_path(default_params) expect(response).to have_http_status(:success) end + + it "displays the first day of the following year as the date when the report will be available" do + get reports_annual_reports_path(default_params) + + expect(response.body).to include("available in #{(Date.current + 1.year).beginning_of_year.strftime("%B%e, %Y")}") + end end describe "GET /show" do From 44d1cfaf9cdaa11c64c5e07d2fee604299f12c5e Mon Sep 17 00:00:00 2001 From: Stefanni Brasil Date: Thu, 21 May 2026 14:41:49 -0600 Subject: [PATCH 2/4] Remove @month_remaining_to_report instance variable --- app/controllers/reports/annual_reports_controller.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/controllers/reports/annual_reports_controller.rb b/app/controllers/reports/annual_reports_controller.rb index 76bc4aff23..0323e41740 100644 --- a/app/controllers/reports/annual_reports_controller.rb +++ b/app/controllers/reports/annual_reports_controller.rb @@ -9,8 +9,6 @@ def index @actual_year = Time.current.year @years = (foundation_year...@actual_year).to_a - - @month_remaining_to_report = 12 - Time.current.month end def show From 07978abef10b082058210c1f502adbbaff0f69c8 Mon Sep 17 00:00:00 2001 From: Stefanni Brasil Date: Thu, 21 May 2026 14:49:10 -0600 Subject: [PATCH 3/4] Fix typo --- app/views/reports/annual_reports/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/reports/annual_reports/index.html.erb b/app/views/reports/annual_reports/index.html.erb index 894bbf4625..176ae93bda 100644 --- a/app/views/reports/annual_reports/index.html.erb +++ b/app/views/reports/annual_reports/index.html.erb @@ -25,7 +25,7 @@
Reports are available at the end of every year.
- <%= "#{@actual_year} (available in #{available_date})" %> + <%= "#{@actual_year} (available on #{available_date})" %>
From ab6799a3d640aca227eb493d278c0c5bda474e11 Mon Sep 17 00:00:00 2001 From: Stefanni Brasil Date: Thu, 21 May 2026 14:49:44 -0600 Subject: [PATCH 4/4] Better test setup and scenarios --- spec/helpers/reports/annual_reports_helper_spec.rb | 14 +++++++++++++- .../reports/annual_reports_requests_spec.rb | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/spec/helpers/reports/annual_reports_helper_spec.rb b/spec/helpers/reports/annual_reports_helper_spec.rb index 3108132bc5..4ce977825f 100644 --- a/spec/helpers/reports/annual_reports_helper_spec.rb +++ b/spec/helpers/reports/annual_reports_helper_spec.rb @@ -1,9 +1,21 @@ RSpec.describe Reports::AnnualReportsHelper, type: :helper do describe "#available_date" do - it "returns the first day of the following year with a custom date format" do + it "returns the first day of the following year when the current date is the first day of a given year" do travel_to Time.zone.local(2026, 0o1, 0o1) expect(helper.available_date).to eq("January 1, 2027") end + + it "returns the first day of the following year when the current date is the last day of a given year" do + travel_to Time.zone.local(2026, 12, 31) + + expect(helper.available_date).to eq("January 1, 2027") + end + + it "returns the first day of the following year" do + travel_to Time.zone.local(2026, 0o4, 15) + + expect(helper.available_date).to eq("January 1, 2027") + end end end diff --git a/spec/requests/reports/annual_reports_requests_spec.rb b/spec/requests/reports/annual_reports_requests_spec.rb index af0fb2570f..94b4c6fc02 100644 --- a/spec/requests/reports/annual_reports_requests_spec.rb +++ b/spec/requests/reports/annual_reports_requests_spec.rb @@ -19,9 +19,11 @@ end it "displays the first day of the following year as the date when the report will be available" do + travel_to Time.zone.local(2026, 12, 31) + get reports_annual_reports_path(default_params) - expect(response.body).to include("available in #{(Date.current + 1.year).beginning_of_year.strftime("%B%e, %Y")}") + expect(response.body).to include("available on January 1, 2027") end end