Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that the load times for
/inventory
were around 2/3 seconds on my machine and so I investigated and found out that the issue was that the template calleditem.quantity
for every item, each of which made two queries on the database. This pull request adds in queries at the inventory level to do the same job with fewer requests to the database.The initial way I did the queries (ff47e60) actually changed the behaviour of the page as it only looked at requests that had been fulfilled without looking at those that had also been approved. cb0dfd2 changes this to fit with the current behaviour and looks at requests that are both approved and fulfilled.
There are also some whitespace changes in the below, since my editor was moaning at me about spaces at the end of lines.
I've written a more in-depth look at the issue available here.
Any comments or suggestions on this pull request, or the changes within are welcome!