Skip to content

Add a new filter to distributions (and CSV) for reporting category#5512

Merged
dorner merged 1 commit intomainfrom
distributions-reporting-category
Mar 13, 2026
Merged

Add a new filter to distributions (and CSV) for reporting category#5512
dorner merged 1 commit intomainfrom
distributions-reporting-category

Conversation

@awwaiid
Copy link
Collaborator

@awwaiid awwaiid commented Mar 8, 2026

Work toward #5511

This adds a new filter to distributions for the reporting category, similar to the existing filters.

Also fix the summary total labels when filters are applied.

Manually tested and added specs!

Also fix the summary total labels when filters are applied
@awwaiid awwaiid requested a review from dorner March 8, 2026 15:25
@total_items_paginated_distributions = @distribution_totals.slice(*paginated_ids).values.sum(&:quantity)
@selected_item_category = filter_params[:by_item_category_id].presence
@reporting_categories = Item.reporting_categories_for_select
@selected_reporting_category = filter_params[:by_reporting_category].presence
Copy link
Collaborator

Choose a reason for hiding this comment

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

When do we give in and realize that we're trying to shove a million instance variables into the view instead of using a proper view object? 😁

it "only shows distributions containing items with the given reporting category" do
get distributions_path, params: params

expect(assigns(:distributions)).to include(distribution_pads)
Copy link
Collaborator

Choose a reason for hiding this comment

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

and ideally to stop testing assigns, which is basically us reaching into private controller code instead of testing outputs.

@dorner dorner merged commit ba62d9e into main Mar 13, 2026
45 of 56 checks passed
@dorner dorner deleted the distributions-reporting-category branch March 13, 2026 19:38
@github-actions
Copy link
Contributor

@awwaiid: Your PR Add a new filter to distributions (and CSV) for reporting category is part of today's Human Essentials production release: 2026.03.15.
Thank you very much for your contribution!

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.

2 participants