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 scopes #7471
Order scopes #7471
Conversation
These aren't used anywhere
Codecov Report
@@ Coverage Diff @@
## master #7471 +/- ##
==========================================
+ Coverage 93.16% 93.17% +0.01%
==========================================
Files 633 633
Lines 18101 18091 -10
==========================================
- Hits 16864 16857 -7
+ Misses 1237 1234 -3
Continue to review full report at Codecov.
|
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.
👏
end | ||
scope :complete, -> { where.not(completed_at: nil) } | ||
scope :incomplete, -> { where(completed_at: nil) } | ||
scope :by_state, lambda { |state| where(state: state) } |
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.
maybe this should also go by using the complete scope on the ProducerMailer?
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 considered that, but I think there's a subtle difference between order.complete
and order.by_state("complete")
. An order in "complete" state will be returned by both scopes, but an order that was completed and then cancelled will be returned by the first but not the second, eg: completed_at
will be a non-nil timestamp but the state will be "cancelled".
What? Why?
Removes some dead code in
Spree::Order
and moves old query methods to chainable scopes.What should we test?
Green build should be enough.
Release notes
Tidied up order scopes.
Changelog Category: Technical changes