-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
Store link to open backorder #12960
Store link to open backorder #12960
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.
Looks good ! Thanks for all the comments on the lookup_open_order
🥇 I don't think I would have understood without them !
app/services/fdc_backorderer.rb
Outdated
&.tap { |o| o.orderStatus = "dfc-v:Held" } | ||
end | ||
|
||
# DEPRICATED |
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.
typo:
# DEPRICATED | |
# DEPRECATED |
Heads up - this is not working! DO NOT MERGE |
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.
Great work, a nice step-by-step approach which seems like it should work perfectly..
But apparently it didn't 😞
@@ -13,7 +13,7 @@ class BackorderJob < ApplicationJob | |||
sidekiq_options retry: 0 | |||
|
|||
def self.check_stock(order) | |||
links = SemanticLink.where(variant_id: order.line_items.select(:variant_id)) | |||
links = SemanticLink.where(subject: order.variants) |
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.
💎✨
@RaggedStaff, do you have any more information on this? You shared a couple of screenshots on Slack with me which state a completed order of:
I found two orders on the staging server that seem to be related. Both were cancelled. But they contain a mix of retail and wholesale items. I don't think we specified that scenario, did we? Also, the resulting Shopify order doesn't have all the items of the two cancelled orders. So something must have gotten cancelled, right? I also noticed that the Can you explain exactly what you did and what you expected? I'm wondering if the real pilots are actually simpler. We had some assumptions:
Some of this may be solved later when we support any way of amending orders but we are not there yet. This pull request just needs to work as well as before. |
9431eff
to
4945f4d
Compare
@RaggedStaff, I just did a little test on staging and everything seemed to work. Steps:
Can you check again? Maybe we can find the edge cases. I guess though that the edge cases never worked. This PR doesn't solve everything, only one little aspect that will allow more. |
No we didn't, the staging Shopify store is in a mess though, cos we keep switching back & forth to test different scenarios.
I think some stuff was in stock, so didn't ever appear on the order.
Ah, yeah that may well be it. I'm pretty sure I used the bulk cancel Order function (selected both orders on the Order screen & cancelled). I think I expected that to cancel both orders and either:
I don't think I'm bothered which way we go, it should result in the same outcome, right? 🤔 I think the edge here may be an empty order... Shopify will not allow an Order without at least 1 OrderLine with hasQuantity > 0. Have you tried cancelling all the Orders & seeing what happens? I think that may explain my issue - the first order was left on the Shopify order (i.e. it failed attempting to back out the last orderline). I would like to confirm that as I'd like better error capture on that in Shopify (& possibly OFN). I'll do a bit more testing now. If that is it, I agree the issue probably existed already & we don't need to address it in this PR. It's (hopefully) quite an unlikely edge case, at least for our current pilots. 🤞🏻 |
Ok. That's not the edge case... I checked with a single order & cancellation... steps to reproduce:
Seems it is multi-order cancellations. I will warn our test hubs not to attempt that & I think we can proceed with this now. Thanks @mkllnk |
Yes, we probably have multiple cancellations run at the same time going into a race condition. I would like to fix that a bit later though, when we amend everything consistently. Hm, maybe it doesn't matter when I fix this. Just a matter of priority. |
And ActiveRecord magic does the rest when used correctly.
We don't use the link yet, but it's there.
Backorder can become empty after a customer cancels their order. Then we don't want to fail but also don't need to place an order.
4945f4d
to
46048dc
Compare
@RaggedStaff, how shall we proceed here?
Do you approve of this PR? Can we merge it? |
After chatting with David, we agree that we can merge this. It has been tested and even though the test failed, we know that this issues have been either addressed or were pre-existing. So let's unblock further work. @RaggedStaff, if you have concerns then you can still opt out of the next release until we fix whatever your concern is. |
ℹ️ Funded Feature. Please track ALL ASSOCIATED WORK under the associated tracking code
#11678 DFC Orders
What? Why?
A new scenario is be possible now:
What should we test?
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates