Skip to content

Conversation

dorner
Copy link
Collaborator

@dorner dorner commented Sep 12, 2025

Resolves #5358

Description

This refactors the DonationsController index methods to use a single view object instead of 20 instance variables. The hope is that we can replicate this approach with further controllers.

@dorner dorner requested a review from awwaiid September 12, 2025 20:34
@@ -0,0 +1,119 @@
module Types
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like we didn't use Dry.Types

@paginated_donations_quantity = @paginated_donations.collect(&:total_quantity).sum
@total_value_all_donations = total_value(@donations)
@paginated_in_kind_value = total_value(@paginated_donations)
@total_money_raised = total_money_raised(@donations)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like several of these helpers should also be removed from this controller now that they live in the view

Copy link
Collaborator

@awwaiid awwaiid left a comment

Choose a reason for hiding this comment

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

bit more extraction remains!

@dorner dorner requested a review from awwaiid September 26, 2025 20:11
@dorner
Copy link
Collaborator Author

dorner commented Sep 26, 2025

@awwaiid fixed!

Copy link
Collaborator

@awwaiid awwaiid left a comment

Choose a reason for hiding this comment

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

All good -- both code & QA

@awwaiid awwaiid merged commit d33b720 into main Sep 28, 2025
28 of 29 checks passed
@awwaiid awwaiid deleted the 5358-donation-refactor branch September 28, 2025 14:21
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.

Refactor donations controller to use a view object
2 participants