foodsoft
foodsoft copied to clipboard
Add sum column to order overview
Closes #822
thanks for targeting that issue, but did you check the performance of your change?
the queries do not join on any of the required associated tables for the sum
method, resulting in a IMO relevant N+1 problem if there are many orders
I did test the performance only with the demo instance at foodcoops.net. What is a possible solution - to optimize the sum
method?
a good solution would be to calculate all the values directly via the database and change all usages of the sum
. An easy solution would be to add all required required models with includes
to the queries
BTW: you also missed to add the sum
for the finished_orders
, which are in the same table