mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Clean up whitespace
This commit is contained in:
@@ -68,7 +68,7 @@ Spree::Admin::ReportsController.class_eval do
|
||||
@search = Spree::Order.complete.not_state(:canceled).managed_by(spree_current_user).search(params[:q])
|
||||
|
||||
@orders = @search.result
|
||||
|
||||
|
||||
render_report(@report.header, @report.table, params[:csv], "customers.csv")
|
||||
end
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ module Spree
|
||||
end
|
||||
|
||||
def report_shipping_method_options(orders)
|
||||
orders.map { |o| o.shipping_method.andand.name }.uniq
|
||||
end
|
||||
orders.map { |o| o.shipping_method.andand.name }.uniq
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
%ul{style: "margin-left: 12pt"}
|
||||
- report_types.each do |report_type|
|
||||
%li
|
||||
%li
|
||||
= link_to report_type[0], "#{order_cycle_management_admin_reports_url}?report_type=#{report_type[1]}"
|
||||
|
||||
@@ -9,15 +9,15 @@
|
||||
= label_tag nil, "Payment Methods (hold Ctrl to select multiple payment methods)"
|
||||
%br
|
||||
|
||||
= select_tag(:payment_method_name,
|
||||
options_for_select(report_payment_method_options(@orders), params[:payment_method_name]),
|
||||
= select_tag(:payment_method_name,
|
||||
options_for_select(report_payment_method_options(@orders), params[:payment_method_name]),
|
||||
multiple: true, include_blank: true, size: 10)
|
||||
%br
|
||||
%br
|
||||
= label_tag nil, "Shipping Method: "
|
||||
= select_tag(:shipping_method_name,
|
||||
= select_tag(:shipping_method_name,
|
||||
options_for_select(report_shipping_method_options(@orders), params[:shipping_method_name]),
|
||||
include_blank: true)
|
||||
include_blank: true)
|
||||
%br
|
||||
%br
|
||||
= check_box_tag :csv
|
||||
|
||||
@@ -116,7 +116,7 @@ end
|
||||
|
||||
Spree::Core::Engine.routes.prepend do
|
||||
match '/admin/reports/orders_and_distributors' => 'admin/reports#orders_and_distributors', :as => "orders_and_distributors_admin_reports", :via => [:get, :post]
|
||||
match '/admin/reports/order_cycle_management' => 'admin/reports#order_cycle_management', :as => "order_cycle_management_admin_reports", :via => [:get, :post]
|
||||
match '/admin/reports/order_cycle_management' => 'admin/reports#order_cycle_management', :as => "order_cycle_management_admin_reports", :via => [:get, :post]
|
||||
match '/admin/reports/group_buys' => 'admin/reports#group_buys', :as => "group_buys_admin_reports", :via => [:get, :post]
|
||||
match '/admin/reports/bulk_coop' => 'admin/reports#bulk_coop', :as => "bulk_coop_admin_reports", :via => [:get, :post]
|
||||
match '/admin/reports/payments' => 'admin/reports#payments', :as => "payments_admin_reports", :via => [:get, :post]
|
||||
|
||||
@@ -8,7 +8,6 @@ module OpenFoodNetwork
|
||||
|
||||
def header
|
||||
["First Name", "Last Name", "Email", "Phone", "Hub", "Shipping Method", "Payment Method", "Amount"]
|
||||
|
||||
end
|
||||
|
||||
def table
|
||||
@@ -16,14 +15,14 @@ module OpenFoodNetwork
|
||||
ba = order.billing_address
|
||||
da = order.distributor.andand.address
|
||||
[ba.firstname,
|
||||
ba.lastname,
|
||||
order.email,
|
||||
ba.phone,
|
||||
order.distributor.andand.name,
|
||||
order.shipping_method.andand.name,
|
||||
order.payments.first.andand.payment_method.andand.name,
|
||||
order.payments.first.amount
|
||||
]
|
||||
ba.lastname,
|
||||
order.email,
|
||||
ba.phone,
|
||||
order.distributor.andand.name,
|
||||
order.shipping_method.andand.name,
|
||||
order.payments.first.andand.payment_method.andand.name,
|
||||
order.payments.first.amount
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -35,7 +34,7 @@ module OpenFoodNetwork
|
||||
filter_to_order_cycle filter_to_payment_method filter_to_shipping_method orders
|
||||
end
|
||||
|
||||
def filter_to_payment_method (orders)
|
||||
def filter_to_payment_method(orders)
|
||||
if params[:payment_method_name].present?
|
||||
orders.with_payment_method_name(params[:payment_method_name])
|
||||
else
|
||||
@@ -43,7 +42,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
end
|
||||
|
||||
def filter_to_shipping_method (orders)
|
||||
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
|
||||
@@ -58,8 +57,5 @@ module OpenFoodNetwork
|
||||
orders
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ module OpenFoodNetwork
|
||||
let!(:order1) { create(:order, shipping_method: sm1, order_cycle: oc1) }
|
||||
let!(:payment1) { create(:payment, order: order1, payment_method: pm1) }
|
||||
|
||||
it "returns all orders sans-params" do
|
||||
it "returns all orders sans-params" do
|
||||
subject.filter(orders).should == orders
|
||||
end
|
||||
|
||||
@@ -84,16 +84,16 @@ module OpenFoodNetwork
|
||||
subject.filter(orders).should == [order1]
|
||||
end
|
||||
|
||||
it "filters to a payment method" do
|
||||
pm2 = create(:payment_method, name: "PM2")
|
||||
order2 = create(:order)
|
||||
payment2 = create(:payment, order: order2, payment_method: pm2)
|
||||
it "filters to a payment method" do
|
||||
pm2 = create(:payment_method, name: "PM2")
|
||||
order2 = create(:order)
|
||||
payment2 = create(:payment, order: order2, payment_method: pm2)
|
||||
|
||||
subject.stub(:params).and_return(payment_method_name: pm1.name)
|
||||
subject.filter(orders).should == [order1]
|
||||
end
|
||||
|
||||
it "filters to a shipping method" do
|
||||
it "filters to a shipping method" do
|
||||
sm2 = create(:shipping_method, name: "ship2")
|
||||
order2 = create(:order, shipping_method: sm2)
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ describe Spree::Order do
|
||||
subject.update_distribution_charge!
|
||||
end
|
||||
|
||||
it "ensures the correct adjustment(s) are created for order cycles" do
|
||||
it "ensures the correct adjustment(s) are created for order cycles" do
|
||||
EnterpriseFee.stub(:clear_all_adjustments_on_order)
|
||||
line_item = double(:line_item)
|
||||
subject.stub(:line_items) { [line_item] }
|
||||
@@ -348,12 +348,12 @@ describe Spree::Order do
|
||||
it "returns the order with payment method name" do
|
||||
Spree::Order.with_payment_method_name('foo').should == [o1]
|
||||
end
|
||||
|
||||
|
||||
it "doesn't return rows with a different payment method name" do
|
||||
Spree::Order.with_payment_method_name('foobar').should_not include o1
|
||||
Spree::Order.with_payment_method_name('foobar').should_not include o2
|
||||
end
|
||||
|
||||
|
||||
it "doesn't return duplicate rows" do
|
||||
p2 = FactoryGirl.create(:payment, :order => o1, :payment_method => pm1)
|
||||
Spree::Order.with_payment_method_name('foo').length.should == 1
|
||||
|
||||
Reference in New Issue
Block a user