Sha256: 9b13adf3a8d66b56edb48e917b818583b7ffc16a41782601877378c6bcbba7a9

Contents?: true

Size: 630 Bytes

Versions: 8

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

module SolidusBacktracs
  module Shipment
    class ExportableQuery
      def self.apply(scope)
        scope = scope
                .order(:updated_at)
                .joins(:order)
                .merge(::Spree::Order.complete)

        unless SolidusBacktracs.configuration.capture_at_notification
          scope = scope.where(spree_shipments: { state: ['ready', 'canceled'] })
        end

        unless SolidusBacktracs.configuration.export_canceled_shipments
          scope = scope.where.not(spree_shipments: { state: 'canceled' })
        end

        scope
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
solidus_bactracs-3.0.0 app/queries/solidus_backtracs/shipment/exportable_query.rb
solidus_backtracs-2.2.6 app/queries/solidus_backtracs/shipment/exportable_query.rb
solidus_backtracs-2.2.5 app/queries/solidus_backtracs/shipment/exportable_query.rb
solidus_backtracs-2.2.4 app/queries/solidus_backtracs/shipment/exportable_query.rb
solidus_backtracs-2.2.3 app/queries/solidus_backtracs/shipment/exportable_query.rb
solidus_backtracs-2.2.2 app/queries/solidus_backtracs/shipment/exportable_query.rb
solidus_backtracs-2.2.1 app/queries/solidus_backtracs/shipment/exportable_query.rb
solidus_backtracs-2.2.0 app/queries/solidus_backtracs/shipment/exportable_query.rb