Skip to content

Improve Availability date on annual report#5571

Open
stefannibrasil wants to merge 5 commits into
rubyforgood:mainfrom
hexdevs:annual-report-months-copy-fix
Open

Improve Availability date on annual report#5571
stefannibrasil wants to merge 5 commits into
rubyforgood:mainfrom
hexdevs:annual-report-months-copy-fix

Conversation

@stefannibrasil
Copy link
Copy Markdown
Contributor

@stefannibrasil stefannibrasil commented May 20, 2026

Resolves #5570

Description

The annual report shows a number of months until the current year's report is available:

Screenshot 2026-05-20 at 17-12-20 Reports - Pawnee Diaper Bank

But it's confusing depending on when this page is accessed. In December, for example, it says it is 0 months until the report is available:

before

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.

Type of change

  • UI update

How Has This Been Tested?

  • unit and request tests

Screenshots

How it looks now:

Screenshot 2026-05-21 at 2 53 37 PM

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.
@stefannibrasil stefannibrasil force-pushed the annual-report-months-copy-fix branch from 6442d24 to 20f4bf6 Compare May 20, 2026 23:14
<div class="row">
<div class="col-md-12 mb-2">
<h5 class="mb-1">Reports are available at the end of every year.</h5>
<span class="text-muted"> <%= "#{@actual_year} (available in #{pluralize(@month_remaining_to_report, 'month')})" %> </span>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the @month_remaining_to_report instance variable now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Removed it in 44d1cfa

<div class="col-md-12 mb-2">
<h5 class="mb-1">Reports are available at the end of every year.</h5>
<span class="text-muted"> <%= "#{@actual_year} (available in #{pluralize(@month_remaining_to_report, 'month')})" %> </span>
<span class="text-muted"> <%= "#{@actual_year} (available in #{available_date})" %> </span>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "available on", not "available in".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Updated it in 07978ab

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)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should have a few edge cases here. I'd probably use

  • Jan 1
  • Dec 31
  • Some time in between

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! The original test was for January 1st, so I added coverage for Dec 31 and a date during the year in ab6799a

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make this explicit, i.e. use travel_to and check the actual date rather than just re-typing the code used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree! Updated this test in ab6799a.

@stefannibrasil stefannibrasil requested a review from dorner May 21, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Availablity on annual report misleading

2 participants