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

FEATURE OrderFactory - record purchases for products, orders #57

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

Conversation

jsirish
Copy link
Member

@jsirish jsirish commented Aug 9, 2020

move the load of calculating inventory for products and variations from the add to cart form to order processing.

As each order is processed, it will query all OrderDetail records and record the number of purchases for product records. It will also query all OrderVariation records and record the number of purchases for Variations

move the load of calculating inventory for products and variations from the add to cart form to order processing.

As each order is processed, it will query all OrderDetail records and record the number of purchases for product records. It will also query all OrderVariation records and record the number of purchases for Variations
@jsirish
Copy link
Member Author

jsirish commented Aug 9, 2020

related to dynamic/silverstripe-foxy-inventory#29

@codecov
Copy link

codecov bot commented Aug 9, 2020

Codecov Report

Merging #57 into master will decrease coverage by 1.11%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #57      +/-   ##
============================================
- Coverage     18.62%   17.51%   -1.12%     
- Complexity       71       80       +9     
============================================
  Files            11       11              
  Lines           204      217      +13     
============================================
  Hits             38       38              
- Misses          166      179      +13     
Flag Coverage Δ Complexity Δ
#php 17.51% <0.00%> (-1.12%) 80.00 <0.00> (+9.00) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
src/Factory/OrderFactory.php 0.00% <0.00%> (ø) 19.00 <0.00> (+9.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8129b9...feff204. Read the comment docs.

Copy link
Member

@muskie9 muskie9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good option for tracking number purchased, however seeing if we can adjust a few things to get it to a single query and return a live number will provide a couple things:

  • Less iteration of all orders
  • Less write() calls (this is in place currently to reduce the number of SELECT queries)

One thing that was noted in #53 is the actual product_total field from the Foxy data feed did not have an accurate count. This may have been patched recently on the Foxy end so we need to revisit that as well. I'll work on generating some test cases to see if we can get a helper method in this module to get the number purchased based on a Product or Variation code.

If we can't get that to work as expected with minimal queries we'll re-focus on this methodology and work out how to reduce the number of iterations required.

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.

2 participants