Class: SolidusShipstation::Shipment::PendingApiSyncQuery
- Inherits:
-
Object
- Object
- SolidusShipstation::Shipment::PendingApiSyncQuery
- Defined in:
- app/queries/solidus_shipstation/shipment/pending_api_sync_query.rb
Constant Summary collapse
- SQLITE_CONDITION =
<<~SQL.squish ( spree_shipments.shipstation_synced_at IS NULL OR ( spree_shipments.shipstation_synced_at IS NOT NULL AND spree_shipments.shipstation_synced_at < spree_orders.updated_at ) ) AND ((JULIANDAY(CURRENT_TIMESTAMP) - JULIANDAY(spree_orders.updated_at)) * 86400.0) < :threshold SQL
- POSTGRES_CONDITION =
<<~SQL.squish ( spree_shipments.shipstation_synced_at IS NULL OR ( spree_shipments.shipstation_synced_at IS NOT NULL AND spree_shipments.shipstation_synced_at < spree_orders.updated_at ) ) AND (EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - spree_orders.updated_at))) < :threshold SQL
- MYSQL2_CONDITION =
<<~SQL.squish ( spree_shipments.shipstation_synced_at IS NULL OR ( spree_shipments.shipstation_synced_at IS NOT NULL AND spree_shipments.shipstation_synced_at < spree_orders.updated_at ) ) AND (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(spree_orders.updated_at)) < :threshold SQL
Class Method Summary collapse
Class Method Details
.apply(scope) ⇒ Object
37 38 39 40 41 42 |
# File 'app/queries/solidus_shipstation/shipment/pending_api_sync_query.rb', line 37 def apply(scope) scope .joins(:order) .merge(::Spree::Order.complete) .where(condition_for_adapter, threshold: SolidusShipstation.config.api_sync_threshold / 1.second) end |