You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inspired by View::Inventory, let's refactor report controller/views to incorporate all the queries into a single object (or set of objects) that can be passed down in the view. Look for any calculation, including things like sum and count in the view... We much prefer views to be extremely dumb and doing nothing but passing existing data into (possibly) rendering functions like number_to_delimiter.
Having a view object which we can calculate allows us a) to not have to deal with five or more instance variables and just have one, and b) to centralize all the logic that calculates that one view object.
Things to consider
No response
Criteria for Completion
Reports controller/views should have minimal calculations
Unit tests on calculations
The text was updated successfully, but these errors were encountered:
Summary
Inspired by View::Inventory, let's refactor report controller/views to incorporate all the queries into a single object (or set of objects) that can be passed down in the view. Look for any calculation, including things like sum and count in the view... We much prefer views to be extremely dumb and doing nothing but passing existing data into (possibly) rendering functions like number_to_delimiter.
Having a view object which we can calculate allows us a) to not have to deal with five or more instance variables and just have one, and b) to centralize all the logic that calculates that one view object.
Things to consider
No response
Criteria for Completion
The text was updated successfully, but these errors were encountered: