mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Use flat_map to make ship methods selection faster
This commit is contained in:
@@ -92,7 +92,7 @@ module OrderManagement
|
||||
#
|
||||
# @return [Array<Spree::ShippingMethod>]
|
||||
def shipping_methods
|
||||
available_shipping_methods = shipping_categories.map(&:shipping_methods).flatten.uniq.to_a
|
||||
available_shipping_methods = shipping_categories.flat_map(&:shipping_methods).uniq.to_a
|
||||
|
||||
available_shipping_methods.keep_if do |shipping_method|
|
||||
ships_with?(order.distributor.shipping_methods.to_a, shipping_method)
|
||||
|
||||
Reference in New Issue
Block a user