mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-17 00:07:24 +00:00
Merge pull request #7196 from Matt-Yorkley/deprecations-uniq
Deprecations: certain uses of #uniq
This commit is contained in:
@@ -3,7 +3,7 @@ class Schedule < ActiveRecord::Base
|
||||
|
||||
has_many :order_cycle_schedules, dependent: :destroy
|
||||
has_many :order_cycles, through: :order_cycle_schedules
|
||||
has_many :coordinators, -> { uniq }, through: :order_cycles
|
||||
has_many :coordinators, -> { distinct }, through: :order_cycles
|
||||
|
||||
scope :with_coordinator, lambda { |enterprise| joins(:order_cycles).where('coordinator_id = ?', enterprise.id).select('DISTINCT schedules.*') }
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ module OpenFoodNetwork
|
||||
def relevant_rates
|
||||
return @relevant_rates unless @relevant_rates.nil?
|
||||
|
||||
@relevant_rates = Spree::TaxRate.uniq
|
||||
@relevant_rates = Spree::TaxRate.distinct
|
||||
end
|
||||
|
||||
def totals_of(line_items)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace :ofn do
|
||||
|
||||
# For each variant in the exchange
|
||||
products = Spree::Product.joins(:variants_including_master).where('spree_variants.id IN (?)', exchange.variants).pluck(:id).uniq
|
||||
producers = Enterprise.joins(:supplied_products).where("spree_products.id IN (?)", products).uniq
|
||||
producers = Enterprise.joins(:supplied_products).where("spree_products.id IN (?)", products).distinct
|
||||
producers.each do |producer|
|
||||
next if producer == exchange.receiver
|
||||
|
||||
|
||||
Reference in New Issue
Block a user