Renamed methods and vars to better fit naming conventions

This commit is contained in:
Lynne Davis
2014-12-12 10:11:33 +00:00
parent 079781576b
commit eeae72352b
3 changed files with 8 additions and 7 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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