-
-
Notifications
You must be signed in to change notification settings - Fork 568
#5358: Refactor donations controller to use a view object #5388
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
app/models/view/donations.rb
Outdated
@@ -0,0 +1,119 @@ | |||
module Types |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
There was a problem hiding this 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!
@awwaiid fixed! |
There was a problem hiding this 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
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.