Skip to content

Refactor inventory check to identify first out-of-stock product #854

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

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

Conversation

seer-by-sentry[bot]
Copy link
Contributor

Fixes REACT-5XC. The issue was that: The enough_inventory? method in the backend checkout controller is hardcoded to return false, causing the "Not enough inventory" exception on every checkout attempt.

  • Changes the inventory check logic to identify and return the first product that is out of stock, rather than iterating through all products and potentially breaking on the first error.
  • Introduces get_first_out_of_stock_product method to determine the first product with insufficient inventory.
  • Modifies the error handling to return immediately upon finding an out-of-stock product, preventing further checks.

This fix was generated by Seer in Sentry, triggered by Danny Abou-Chakra. 👁️ Run ID: 76894

Not quite right? Click here to continue debugging with Seer.

Copy link

vercel bot commented Jun 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
empower ⬜️ Ignored (Inspect) Visit Preview Jun 12, 2025 0:48am

Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 27.76%. Comparing base (8573fd1) to head (89b2b76).
Report is 1 commits behind head on master.

✅ All tests successful. No failed tests found.

❌ Your project check has failed because the head coverage (27.76%) is below the target coverage (35.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #854      +/-   ##
==========================================
- Coverage   27.86%   27.76%   -0.11%     
==========================================
  Files          41       41              
  Lines        1055     1059       +4     
  Branches      115      115              
==========================================
  Hits          294      294              
- Misses        742      746       +4     
  Partials       19       19              
Flag Coverage Δ
api 6.58% <ø> (-0.06%) ⬇️
frontend 44.72% <ø> (ø)
Components Coverage Δ
checkout_module 6.58% <ø> (-0.06%) ⬇️
product_component 41.47% <ø> (ø)

see 3 files with indirect coverage changes

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.

0 participants