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

check_basket_is_valid recalculates purchase info of a basket Line #2044

Closed
mblayman opened this issue May 5, 2016 · 3 comments
Closed

check_basket_is_valid recalculates purchase info of a basket Line #2044

mblayman opened this issue May 5, 2016 · 3 comments

Comments

@mblayman
Copy link

mblayman commented May 5, 2016

I work on an application where price calculation is dynamic and expense computationally. While trying to optimize my application code, I found that check_basket_is_valid does not use the cached purchase_info property available for basket lines. Because of this, I have certain Django views that are doing redundant work.

Since it calls fetch_for_line directly, it bypasses the proxying work and cache that Line.purchase_info provides.

@mvantellingen
Copy link
Contributor

Can you supply a PR for this? Thanks :-)

@sasha0
Copy link
Member

sasha0 commented Jul 31, 2016

This won't work since availability and stockrecord will be cached, and then, if we allocate remaining number of the stock record and it becomes unavailable - check_basket_is_valid would still pass.

I added tests to verify this.

@sasha0
Copy link
Member

sasha0 commented Apr 6, 2017

Closing since my test proofs appropriateness of current implementation. If you have other suggestion for performance improvement - please open a new issue. Thanks!

@sasha0 sasha0 closed this as completed Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants