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 =
"(\n spree_shipments.shipstation_synced_at IS NULL\n OR (\n spree_shipments.shipstation_synced_at IS NOT NULL\n AND spree_shipments.shipstation_synced_at < spree_orders.updated_at\n )\n) AND ((JULIANDAY(CURRENT_TIMESTAMP) - JULIANDAY(spree_orders.updated_at)) * 86400.0) < :threshold\n".squish
- POSTGRES_CONDITION =
"(\n spree_shipments.shipstation_synced_at IS NULL\n OR (\n spree_shipments.shipstation_synced_at IS NOT NULL\n AND spree_shipments.shipstation_synced_at < spree_orders.updated_at\n )\n) AND (EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - spree_orders.updated_at))) < :threshold\n".squish
- MYSQL2_CONDITION =
"(\n spree_shipments.shipstation_synced_at IS NULL\n OR (\n spree_shipments.shipstation_synced_at IS NOT NULL\n AND spree_shipments.shipstation_synced_at < spree_orders.updated_at\n )\n) AND (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(spree_orders.updated_at)) < :threshold\n".squish
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 |