Module: SpreeCmCommissioner::Transit::OrderQueryHelper
- Defined in:
- app/helpers/spree_cm_commissioner/transit/order_query_helper.rb
Class Method Summary collapse
Class Method Details
.transit_orders_for_vendor(vendor_id) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/spree_cm_commissioner/transit/order_query_helper.rb', line 4 def self.transit_orders_for_vendor(vendor_id) return Spree::Order.none if vendor_id.nil? Spree::Order .includes(:user, :created_by, { payments: :payment_method }, { line_items: { variant: :product } }) .joins(line_items: { variant: :product }) .where(spree_products: { product_type: :transit }) .where(spree_variants: { vendor_id: vendor_id }) .distinct .order(created_at: :desc) end |