5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/models/spree/shipment_decorator.rb', line 5
def self.prepended(base)
base.scope :exportable, lambda {
joins(:order)
.merge(::Spree::Order.complete)
.where(state: "ready")
.order(:updated_at)
.includes(:order, inventory_units: {line_item: {variant: [:product, :images, {option_values: :option_type}]}})
}
base.scope :between, lambda { |from, to|
return all if from.nil? && to.nil?
range = from..to
shipment_match = joins(:order).where(updated_at: range)
order_match = joins(:order).where(spree_orders: {updated_at: range})
shipment_match.or(order_match).distinct
}
end
|