-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Order data inconsistency between Line Items and Inventory Items (was: snail in admin edit orders) #4186
Comments
Any more info on this @mklink ? I tried looking at replicating the bug, but didn't have much success. I see we have some specs covering the case where a variant is deleted and the orders page will still display, but this is obviously a slightly different issue, caused by a discrepancy between the shipment's items and the order's line_items. I can see the order in Aus production has no address and no line items at all, which makes this part of the bug report confusing:
The order and payment went through without an address? |
I don't have any more info either. |
I've added a pending spec in #4205. The order edit page loops through the items in the shipment's I can add a callback when destroying a |
@Matt-Yorkley I think this maybe the fix (spree 2.2) :-) |
@luisramos0 we already have a similar callback when destroying a line_item: openfoodnetwork/app/models/spree/line_item_decorator.rb Lines 156 to 167 in fa1becb
It looks like if I call I haven't been able to actually replicate this via the UI (only in an abstract test), and I haven't been able to create a reasonable test that shows how this error actually occurs in the app. I thought this might be the cause: openfoodnetwork/app/controllers/spree/orders_controller.rb Lines 189 to 191 in fa1becb
...but the above only seems to be called from the edit basket page when working with an order in the cart state, and at that point it doesn't have a shipment yet, so it doesn't trigger the error. I think I'll stick this back in |
this is a brain twister! I just spent 2 hours on this without a single conclusion 😭 |
@luisramos0 shall we move it back to s3 and out of dev ready? |
I dont know. @mkllnk what do you think? |
We don't have a workaround which makes it an s2 by definition. But it affects very few users, maybe it affected only one real user. I'll degrade it to s3 for now but we may have to bump it up again if it occurs again. |
We had one more case of this: https://app.bugsnag.com/yaycode/openfoodnetwork/errors/5e7c2499183e6e0018839df6 |
This issue has been linked to an error in Bugsnag |
Shopper contacted us to say that their order to Sugarloaf Produce doesn't appear in their account. The shopper has paid by EFT but the order hasn't been processed (it's incomplete) and can't be viewed by anyone (superadmin, customer or enterprise) due to this issue. There appear to be two failed orders in admin, both in address state, both with balance due. They can't be edited/opened (snail) so It's therefore not possible to investigate the order, find out what they ordered, provide a refund or work with the order in any other way. The shopper has been advised to attempt to re-order. |
Hello @emilyjeanrogers I think it's important with dont share customer data in this public issue in github. I removed the user email from your comment above. |
It wouldnt fix the root cause, but it will be very easy to make the view _shipment_manifest.html ignore the nil line_items. That would fix the snail. |
I am working on a work around PR for this, I'll make the order edit page work when the order has inventory_items in the shipment but the respective line_item as been removed. |
#5253 solves the problem of the broken order edit page, it doesnt fix the data problem in the order. So, I am moving to Test Ready and marking this prod-test and blocked so that we can verify how the situation is in live after #5253 is released. |
Hey @filipefurtad0 and @luisramos0 #5253 is in the latest release so this issue can be tested on production as soon as it's deployed. 🎉 |
@kirstenalarsen are you able to test in production? The issues give a link to a specific example in AU prod. |
I clicked that link and I see a snail. The order does not exist in the database!? The issue is from Aug 2019, what happened to this order!? I went to bugsnag and tried one of the errors there, for this second order, the page now loads: Maybe we can keep the issue open as the root problem is not solved but it's not an S2 anylonger, right? Maybe s3? |
Improve order edit page in data inconsistency scenario (follow up from S2 #4186)
I think this problem is now an S3 as the users can see the order. The data inconsistency is still there and the root cause is still unknown. |
Description
Some orders can't be edited by an admin. The Bugsnag error suggests that a variant got removed from an order (I guess it was out of stock) but the order's manifest is still referencing the variant. The view displaying the edit order screen fails to find the line item for the missing variant and crashes trying to access it.
Expected Behavior
You can always edit an order as admin.
Actual Behaviour
We can't edit at least one order.
Steps to Reproduce
Context
That order is in
address
state and can't be edited.I also think that variants removed from the cart because they are out of stock, causes this error: https://app.bugsnag.com/yaycode/openfoodnetwork/errors/5c625e38b659cb00191b1307
Severity
bug-s2: a non-critical feature is broken, no workaround
Your Environment
Possible Fix
Bugsnag
ActionView::Template::Error in spree/admin/orders#edit
undefined method `single_money' for nil:NilClass
View on Bugsnag
Stacktrace
The text was updated successfully, but these errors were encountered: