mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Apply code style following Rubocop
This commit is contained in:
@@ -56,10 +56,10 @@ module InjectionHelper
|
||||
data_array = spree_current_user.orders_by_distributor.to_a
|
||||
data_array.each do |enterprise|
|
||||
enterprise.distributed_orders.each do |order|
|
||||
order.payments.keep_if{ |payment| payment.state == "completed" }
|
||||
order.payments.keep_if { |payment| payment.state == "completed" }
|
||||
end
|
||||
end
|
||||
data_array.sort!{ |a, b| b.distributed_orders.length <=> a.distributed_orders.length }
|
||||
data_array.sort! { |a, b| b.distributed_orders.length <=> a.distributed_orders.length }
|
||||
inject_json_ams "orders_by_distributor", data_array, Api::OrdersByDistributorSerializer
|
||||
end
|
||||
|
||||
|
||||
@@ -56,7 +56,11 @@ Spree.user_class.class_eval do
|
||||
|
||||
# Returns orders and their associated payments for all distributors that have been ordered from
|
||||
def orders_by_distributor
|
||||
Enterprise.includes(distributed_orders: :payments).where(enterprises: { id: self.enterprises_ordered_from }, spree_orders: { state: 'complete', user_id: self.id }).order('spree_orders.completed_at DESC')
|
||||
Enterprise.includes(distributed_orders: :payments).
|
||||
where(
|
||||
enterprises: { id: self.enterprises_ordered_from },
|
||||
spree_orders: { state: 'complete', user_id: self.id }).
|
||||
order('spree_orders.completed_at DESC')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user