-
-
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
[Spree 2 Upgrade] - Added adapted order.shipping_method #2654
[Spree 2 Upgrade] - Added adapted order.shipping_method #2654
Conversation
3f4935f
to
a082478
Compare
3978256
to
5df04ad
Compare
hey @sauloperez @mkllnk @HugsDaniel I think that would be the best approach. If you guys agree, I can create that class and write some unit tests and docs for it. |
Moving to "Code Review" to get feedback. Will move back to "In Dev" once feedback is gathered and decisions taken. |
I like the separation in a concern. The decorator is too big anyway and I don't see any downside. |
app/models/spree/order_decorator.rb
Outdated
# Thus, this method returns the shipping method of the first and only shipment in the order | ||
def shipping_method | ||
return if shipments.empty? | ||
shipments.first.shipping_method |
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.
We should enforce this at DB level as we did in #2638.
Agree @luisramos0 |
all right, thanks for the feedback! |
5df04ad
to
fc75eaa
Compare
This is ready for review with new concern, unit tests, docs and db constraint. |
By forbidding more than a row per order in the spree_shipments table we ensure all orders have no more than one shipment associated
f71c978
to
c00e6a5
Compare
I have copied the approach from #2638 See this comment: |
remove_index :spree_shipments, :order_id | ||
add_index :spree_shipments, :order_id, unique: true | ||
end | ||
end |
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 couldn't stop myself @luisramos0 . I hope there was nothing missing. |
ahaha, awesome, lets do this 🎉 |
Marking this one as part of #2009, but not closing it. |
What? Why?
Part of #2009
WIP: This is the quick fix, it still needs cleaning up, docs and tests.
What should we test?
More specs fixed.
Release notes
Changelog Category: Fixed
Adapted to spree 2 multi shipments by adding adapted shipping method to order.
How is this related to the Spree upgrade?
This is part fo the spree upgrade.