Skip to content

4987 annual survey export#5540

Open
angyb00 wants to merge 6 commits intorubyforgood:mainfrom
angyb00:4987-annual-survey-export
Open

4987 annual survey export#5540
angyb00 wants to merge 6 commits intorubyforgood:mainfrom
angyb00:4987-annual-survey-export

Conversation

@angyb00
Copy link
Copy Markdown

@angyb00 angyb00 commented Apr 20, 2026

Resolves #4987

Description

This builds off the work that was started in #5274 and #5199. This implementation fixes the issue of different years having different columns; all header columns are now included.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

This has been tested through the UI and rspec.

Screenshots

Screen.Recording.2026-04-19.at.6.50.26.PM.mov

year_start = [range_params[:year_start].to_i, current_organization.earliest_reporting_year].max
year_end = [range_params[:year_end].to_i, Time.current.year].min

year_start, year_end = [year_start, year_end].minmax
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.

We probably want to fail loudly if end < start, not silently swap them.


private

def get_range_report(year_start, year_end)
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.

Prefer methods that don't start with get. In this case, probably also better to move this method to the service class.

not_found! unless range_params[:year_start] =~ year_regex && range_params[:year_end] =~ year_regex
end

def year_regex
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 a constant, not a method.

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.

Wait, isn't this already validated by the routes file?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, that seems to be the case.

text: "Export Yearly Reports"
)
%>
This will recalculate all the reports, and may take some time.
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 might make sense to pair with #5495. Not sure if using this with actual data might time out right now.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, that's reasonable. I saw that the PR was stale, so I just created a new PR based off it here: #5542. The new PR contains some changes based on the feedback. I think we should release that PR first to see that everything is working fine for distributions, and then I can update this PR once those changes are successfully integrated. How does that sound?

@angyb00 angyb00 requested a review from dorner April 25, 2026 04:06
@angyb00
Copy link
Copy Markdown
Author

angyb00 commented Apr 25, 2026

Thanks for reviewing, @dorner. Made the changes you requested 🙂.

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.

Annual survey export - make it work across years

2 participants