mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Renamed methods and vars to better fit naming conventions
This commit is contained in:
@@ -12,7 +12,7 @@ module Spree
|
||||
orders.map { |o| o.payments.first.payment_method.andand.name }.uniq
|
||||
end
|
||||
|
||||
def report_distribution_options(orders)
|
||||
def report_shipping_options(orders)
|
||||
orders.map { |o| o.shipping_method.andand.name }.uniq
|
||||
end
|
||||
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
multiple: true, include_blank: true)
|
||||
%br
|
||||
%br
|
||||
= select_tag(:distribution_name,
|
||||
options_for_select(report_distribution_options(@orders), params[:distribution_name]),
|
||||
= label_tag nil, "Shipping Method: "
|
||||
= select_tag(:shipping_method_name,
|
||||
options_for_select(report_shipping_options(@orders), params[:shipping_method_name]),
|
||||
include_blank: true)
|
||||
%br
|
||||
%br
|
||||
|
||||
@@ -32,7 +32,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
def filter(orders)
|
||||
filter_to_order_cycle filter_to_payment_method filter_to_distribution orders
|
||||
filter_to_order_cycle filter_to_payment_method filter_to_shipping_method orders
|
||||
end
|
||||
|
||||
def filter_to_payment_method (orders)
|
||||
@@ -43,9 +43,9 @@ module OpenFoodNetwork
|
||||
end
|
||||
end
|
||||
|
||||
def filter_to_distribution (orders)
|
||||
if params[:distribution_name].present?
|
||||
orders.joins(:shipping_method).where("spree_shipping_methods.name = ?", params[:distribution_name])
|
||||
def filter_to_shipping_method (orders)
|
||||
if params[:shipping_method_name].present?
|
||||
orders.joins(:shipping_method).where("spree_shipping_methods.name = ?", params[:shipping_method_name])
|
||||
else
|
||||
orders
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user