-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Refactor Stock Quantifier to use Enumerable #4291
Refactor Stock Quantifier to use Enumerable #4291
Conversation
5fefd82
to
9ec786c
Compare
9ec786c
to
ff93926
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work! Thank for all this optimization work. 🙏🏻
I have one tiny non-blocking nit.
frontend/spec/features/checkout_confirm_insufficient_stock_spec.rb
Outdated
Show resolved
Hide resolved
ff93926
to
e0c6c91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mamhoff! I like this change but I don't get who is passing the id of the stock location to the initialize of the quantifier. Is that something you need to change in your own app or something we already support in core?
frontend/spec/features/checkout_confirm_insufficient_stock_spec.rb
Outdated
Show resolved
Hide resolved
This allows a developer to preload stock items and stock location, removing many, many n+1 queries to the database.
e0c6c91
to
1b2cf01
Compare
We need to reload the variant's stock items in these before blocks now, otherwise the code under test doesn't see that the count on hand has changed.
1b2cf01
to
c8cc04b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
As done in the main repository, there are some changes needed in the specs after some changes happened in the StockQuantifier. See solidusio/solidus#4291 for more information.
This allows a developer to preload stock items and stock location,
removing many, many n+1 queries to the database.
Checklist: