diff --git a/app/models/spree/order.rb b/app/models/spree/order.rb index 2a919c5463..b3980058a8 100644 --- a/app/models/spree/order.rb +++ b/app/models/spree/order.rb @@ -126,38 +126,14 @@ module Spree joins('LEFT OUTER JOIN spree_products ON (spree_products.id = spree_variants.product_id)') } - scope :not_state, lambda { |state| - where.not(state: state) - } - # All the states an order can be in after completing the checkout FINALIZED_STATES = %w(complete canceled resumed awaiting_return returned).freeze scope :finalized, -> { where(state: FINALIZED_STATES) } - - def self.by_number(number) - where(number: number) - end - - def self.between(start_date, end_date) - where(created_at: start_date..end_date) - end - - def self.by_customer(customer) - joins(:user).where("#{Spree.user_class.table_name}.email" => customer) - end - - def self.by_state(state) - where(state: state) - end - - def self.complete - where('completed_at IS NOT NULL') - end - - def self.incomplete - where(completed_at: nil) - end + scope :complete, -> { where.not(completed_at: nil) } + scope :incomplete, -> { where(completed_at: nil) } + scope :by_state, lambda { |state| where(state: state) } + scope :not_state, lambda { |state| where.not(state: state) } # For compatiblity with Calculator::PriceSack def amount