-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Introduce a dataloader for available quantity #5707
Introduce a dataloader for available quantity #5707
Conversation
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.
I think docstrings could be nice before a wall of code
This pull request fixes 1 alert when merging 511c735b3b1c649143b89a0466dd1ca2bcb6dd85 into ea8e38c - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging aa27c88c8462c5eca87ac4f34045798657e4ca27 into b91b6ff - view on LGTM.com fixed alerts:
|
It's not very readable but we want to return the maximum available in any single shipping zone which means the loader needs to operate on several tables at once. TODO: - Figure out how to handle variant.track_inventory, it seems wasteful to calculate things for products that don't care about stock, maybe we should rethink requiring a stock record to exist?
Codecov Report
@@ Coverage Diff @@
## master #5707 +/- ##
==========================================
+ Coverage 91.87% 91.90% +0.03%
==========================================
Files 321 324 +3
Lines 20064 20164 +100
Branches 1836 1858 +22
==========================================
+ Hits 18434 18532 +98
- Misses 1197 1198 +1
- Partials 433 434 +1
Continue to review full report at Codecov.
|
Here is the report for 92815c4 (patrys/saleor @ quantity-available-dataloader) **Found 6 differences!** (click me)
# saleor.graphql.accountbenchmark account
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
delete staff members 32 32 0
query staff user 21 21 4
staff create 24 24 5
staff update groups and permissions 36 36 6
# saleor.graphql.accountbenchmark permission group
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
permission group create 21 21 3
permission group delete 22 22 4
permission group query 8 8 0
permission group update 36 36 2
permission group update remove users with manage staff 31 31 4
# saleor.graphql.checkoutbenchmark checkout mutations
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
add billing address to checkout 50 50 26
add shipping to checkout 37 37 11
checkout email update 28 28 13
checkout payment charge 27 27 6
checkout shipping address update 33 33 8
checkout voucher code 57 57 31
complete checkout 73 73 19
+ create checkout 134 130 65
+ update checkout lines 101 97 45
# saleor.graphql.checkoutbenchmark homepage
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
user checkout details 50 50 26
# saleor.graphql.menubenchmark homepage
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
+ retrieve main menu 8 5 0
+ retrieve secondary menu 8 5 0
# saleor.graphql.orderbenchmark order
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
user order details 17 17 2
# saleor.graphql.productbenchmark category
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
category view 18 18 1
# saleor.graphql.productbenchmark collection
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
collection view 17 17 0
# saleor.graphql.productbenchmark homepage
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
featured products list 14 14 0
retrieve product list 5 5 0
# saleor.graphql.productbenchmark product
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
+ product details 17 16 0
retrieve product attributes 7 7 0
# saleor.graphql.productbenchmark variant
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
product variant bulk create 48 48 2
+ retrieve variant list 30 18 2
# saleor.graphql.productbenchmark variant stocks
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
product variants stocks create 23 23 5
product variants stocks delete 20 20 5
product variants stocks update 28 28 5
# saleor.graphql.producttest product sorting attributes
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
sort product not having attribute data 20 20 0
# saleor.graphql.shopbenchmark homepage
test name left count right count duplicate count
----------------------------------------------------------- ----------- ----------- ---------------
retrieve shop 2 2 0 |
This pull request introduces 1 alert and fixes 1 when merging 811d9e19b9b155f71ee5943fc09a14a7f12cce5d into 5a6d2a7 - view on LGTM.com new alerts:
fixed alerts:
|
This pull request fixes 1 alert when merging b44dad1 into 5a6d2a7 - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging 92815c4 into 89c7f35 - view on LGTM.com fixed alerts:
|
It's not very readable but we want to return the maximum available in any single shipping zone which means the loader needs to operate on several tables at once.
TODO:
Figure out how to handle variant.track_inventory, it seems wasteful to calculate things for products that don't care about stock, maybe we should rethink requiring a stock record to exist?New flow for products without inventory tracking:
If staff user create an available product without inventory tracking, the product is available to buy in any shipping zone and max quantity is
settings.MAX_CHECKOUT_LINE_QUANTITY
.Stocks with any quantity for a product without inventory tracking are needed when any staff user want to create fulfillment with this product. (Fulfillment don't decrease quantity for a product without inventory tracking)
Impact
Pull Request Checklist