mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Make tag_rulee_applicator and available_payment_methods_filter handle case where a relation is given instead of an array
This commit is contained in:
@@ -2,9 +2,9 @@ module OpenFoodNetwork
|
||||
class AvailablePaymentMethodFilter
|
||||
def filter!(payment_methods)
|
||||
if stripe_enabled?
|
||||
payment_methods.reject!{ |p| p.type.ends_with?("StripeConnect") && stripe_configuration_incomplete?(p) }
|
||||
payment_methods.to_a.reject!{ |p| p.type.ends_with?("StripeConnect") && stripe_configuration_incomplete?(p) }
|
||||
else
|
||||
payment_methods.reject!{ |p| p.type.ends_with?("StripeConnect") }
|
||||
payment_methods.to_a.reject!{ |p| p.type.ends_with?("StripeConnect") }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ module OpenFoodNetwork
|
||||
def filter!(subject)
|
||||
return unless subject.respond_to?(:any?) && subject.any?
|
||||
|
||||
subject.reject! do |element|
|
||||
subject.to_a.reject! do |element|
|
||||
if rule_class.respond_to?(:tagged_children_for)
|
||||
children = rule_class.tagged_children_for(element)
|
||||
children.reject! { |child| reject?(child) }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
require 'open_food_network/tag_rule_applicator'
|
||||
require 'spec_helper'
|
||||
|
||||
module OpenFoodNetwork
|
||||
describe TagRuleApplicator do
|
||||
|
||||
Reference in New Issue
Block a user