mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix enterprise model scopes by making ready_for_checkout return enterprises and not ids again and by making not_ready_for_checkout select the id field from the ready_for_checkout scope
This commit is contained in:
@@ -111,12 +111,12 @@ class Enterprise < ActiveRecord::Base
|
||||
joins(:shipping_methods).
|
||||
joins(:payment_methods).
|
||||
merge(Spree::PaymentMethod.available).
|
||||
select('enterprises.id')
|
||||
select('DISTINCT enterprises.*')
|
||||
}
|
||||
scope :not_ready_for_checkout, lambda {
|
||||
# When ready_for_checkout is empty, return all rows when there are no enterprises ready for
|
||||
# checkout.
|
||||
ready_enterprises = Enterprise.ready_for_checkout
|
||||
ready_enterprises = Enterprise.ready_for_checkout.select('enterprises.id')
|
||||
if ready_enterprises.present?
|
||||
where("enterprises.id NOT IN (?)", ready_enterprises)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user