Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Cache query to fetch Price Lists (#13443)
Damian Legawiecae1b3ab01399
diff --git a/core/app/models/spree/price_list.rb b/core/app/models/spree/price_list.rbindex c60cd4fac2..291c7d0865 100644--- a/core/app/models/spree/price_list.rb+++ b/core/app/models/spree/price_list.rb@@ -44,7 +44,8 @@ module Spreescope :for_store, ->(store) { where(store: store) }scope :current, lambda { |timezone = nil|timezone ||= Rails.application.config.time_zone- current_time = Time.current.in_time_zone(timezone)+ # Round to beginning of minute to enable Rails query caching+ current_time = Time.current.in_time_zone(timezone).beginning_of_minutewhere('starts_at IS NULL OR starts_at <= ?', current_time).where('ends_at IS NULL OR ends_at >= ?', current_time)}