You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unvetted Repro!
In this example, when trying to place an order on Sep 3 for 3 units to be delivered on Sep 7, clicking Place Order takes you to 404 page. If you type in a high number for quantity on /cart an error message tells you there are only 14 available which is correct. In debugging this issue, it's likely that the cart code is looking at the order date vs. delivery date to determine what lot inventory is available and thinking there is only 2. There should be 14 in inventory as Sep 7 would include the lot of 12 as well as the 2 undated units.
See error message if there is indeed a legit error
Should also fire warning off to rollbar if there is a rescued error in create_order
But in this case there shouldn't be an error, so fix inventory code
Product:
Outstanding Question:
Rob thinks Good From and Expires On should be relative to the delivery date not the current time.
Tech Notes
Here is the start of debugging. First off, at least it should not show 404 but send back the error message to the user. Secondly, we should do a Rollbar.warning in this case too so we understand how often this is happening. Thirdly, should fix and unify the inventory calculation which seems to be root cause of this particular bug.
My start:
diff --git a/app/interactors/create_order.rb b/app/interactors/create_order.rb
index bf69746f9..422708c47 100644
--- a/app/interactors/create_order.rb
+++ b/app/interactors/create_order.rb
@@ -69,18 +68,21 @@ class CreateOrder
begin
order.add_cart_items(cart.items, cart.delivery.deliver_on)
success = order.save
- rescue
- # empty
+ rescue e
+ Rollbar.error(e)
end
unless success
+ Rollbar.error('Could not create order', errors: order.errors.full_messages)
raise ActiveRecord::Rollback
end
end
+ binding.pry
+ # Why does rollback_order still get called but method doens't continue after that before rolling back interactor?
unless success
rollback_order(order)
end
The text was updated successfully, but these errors were encountered:
rbarreca
changed the title
Placing order goes to 'Page not found' error screen when ordering a product with certain inventory lot combinations
Cart inventory check not accurately warning of dated inventory resulting in placing order going to 'Page not found' error screen
Sep 4, 2018
rbarreca
changed the title
Cart inventory check not accurately warning of dated inventory resulting in placing order going to 'Page not found' error screen
Placing order goes to 'Page not found' error screen due to inaccurate 'expires on' inventory lot addition
Sep 4, 2018
Unvetted Repro!
In this example, when trying to place an order on Sep 3 for 3 units to be delivered on Sep 7, clicking Place Order takes you to 404 page. If you type in a high number for quantity on
/cart
an error message tells you there are only 14 available which is correct. In debugging this issue, it's likely that the cart code is looking at the order date vs. delivery date to determine what lot inventory is available and thinking there is only 2. There should be 14 in inventory as Sep 7 would include the lot of 12 as well as the 2 undated units.Actual
You'll see 404
Expected
Product:
Outstanding Question:
Good From
andExpires On
should be relative to the delivery date not the current time.Tech Notes
Here is the start of debugging. First off, at least it should not show 404 but send back the error message to the user. Secondly, we should do a
Rollbar.warning
in this case too so we understand how often this is happening. Thirdly, should fix and unify the inventory calculation which seems to be root cause of this particular bug.My start:
The text was updated successfully, but these errors were encountered: