human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

Refactor report controller/views to remove local calculations

Open awwaiid opened this issue 1 year ago • 4 comments

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

awwaiid avatar Feb 25 '24 15:02 awwaiid

It should also make any effort to speed up the things easier -- and a couple of the reports desperately need some speeding up.

cielf avatar Feb 26 '24 20:02 cielf

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.

github-actions[bot] avatar Mar 28 '24 00:03 github-actions[bot]

Automatically unassigned after 7 days of inactivity.

github-actions[bot] avatar Apr 04 '24 00:04 github-actions[bot]

@awwaiid does this apply across all the bits we are putting under reports with dashboard, or is it just the annual report?

cielf avatar Apr 04 '24 21:04 cielf