human-essentials
human-essentials copied to clipboard
Refactor report controller/views to remove local calculations
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
- [ ] Reports controller/views should have minimal calculations
- [ ] Unit tests on calculations
It should also make any effort to speed up the things easier -- and a couple of the reports desperately need some speeding up.
This issue is marked as stale due to no activity within 30 days. If no further activity is detected within 7 days, it will be unassigned.
Automatically unassigned after 7 days of inactivity.
@awwaiid does this apply across all the bits we are putting under reports with dashboard, or is it just the annual report?