Skip to content
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

Add sum column to order overview #964

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kidhab
Copy link
Contributor

@kidhab kidhab commented Oct 28, 2022

Closes #822

@paroga
Copy link
Member

paroga commented Oct 28, 2022

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

@kidhab
Copy link
Contributor Author

kidhab commented Oct 28, 2022

I did test the performance only with the demo instance at foodcoops.net. What is a possible solution - to optimize the sum method?

@paroga
Copy link
Member

paroga commented Oct 29, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add column displaying the "total value of order" to order list
2 participants