-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix Shipment#update_attributes_and_order - run full order updater #1514
Fix Shipment#update_attributes_and_order - run full order updater #1514
Conversation
bc39758
to
dc70aa7
Compare
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.
👍
I love the direction for this. If we can remove some of the crazy order updater bypassing like this, we can optimize things by making the order updater faster and more intelligent about what it needs to update rather than having that logic strewn about.
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.
Yes, this is good. Concentrate all the tax stuff in the order updater. :)
What was the issue in the |
@jhawthorn see the commit message on the first commit:
Yah I can create a spec for that. Will do. |
@jhawthorn I've added a spec for the factory |
|
||
create(:shipment, order: order, cost: evaluator.shipment_cost, shipping_method: evaluator.shipping_method, stock_location: evaluator.stock_location) | ||
order.shipments.reload | ||
|
||
order.create_tax_charge! |
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.
I think this is no longer necessary thanks to your work in #1479
This order wasn't set up in a valid way. Just running `order.update!` would mess up the test values.
Tax charges aren't being updated when the shipping method changed because some parts of OrderUpdater aren't being run in `Shipment#update_attributes_and_order`.
Tax charges aren't being updated when the shipping method changes because some parts of OrderUpdater aren't being run in `Shipment#update_attributes_and_order`.
52c1995
to
86f2e33
Compare
@jordan-brough I rebased and removed the first commit, which was unnecessary as of #1479 🎉 |
I also think that this simplification is brilliant, and @gmacdougall said it all very well. Thanks a lot! |
Tax charges aren't being updated when the shipping method changes
because some parts of OrderUpdater aren't being run in
Shipment#update_attributes_and_order
.Also fix an issue in order_factory around shipment taxes.
See individual commits.