mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Merge pull request #7362 from richardc2117/master
Fixes Alphabetical Sorting In Packing Reports
This commit is contained in:
@@ -53,7 +53,7 @@ module OpenFoodNetwork
|
||||
{ group_by: proc { |line_item| line_item.order.distributor },
|
||||
sort_by: proc { |distributor| distributor.name } },
|
||||
{ group_by: proc { |line_item| line_item.order },
|
||||
sort_by: proc { |order| order.bill_address.lastname },
|
||||
sort_by: proc { |order| order.bill_address.lastname.downcase },
|
||||
summary_columns: [proc { |_line_items| "" },
|
||||
proc { |_line_items| "" },
|
||||
proc { |_line_items| "" },
|
||||
@@ -89,7 +89,7 @@ module OpenFoodNetwork
|
||||
{ group_by: proc { |line_item| line_item.full_name },
|
||||
sort_by: proc { |full_name| full_name } },
|
||||
{ group_by: proc { |line_item| line_item.order },
|
||||
sort_by: proc { |order| order.bill_address.lastname } }]
|
||||
sort_by: proc { |order| order.bill_address.lastname.downcase } }]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ feature '
|
||||
login_as_admin_and_visit spree.admin_reports_path
|
||||
end
|
||||
|
||||
let(:bill_address1) { create(:address, lastname: "Aman") }
|
||||
let(:bill_address2) { create(:address, lastname: "Bman") }
|
||||
let(:bill_address1) { create(:address, lastname: "MULLER") }
|
||||
let(:bill_address2) { create(:address, lastname: "Mistery") }
|
||||
let(:distributor_address) { create(:address, address1: "distributor address", city: 'The Shire', zipcode: "1234") }
|
||||
let(:distributor) { create(:distributor_enterprise, address: distributor_address) }
|
||||
let(:order1) { create(:order, distributor: distributor, bill_address: bill_address1) }
|
||||
@@ -129,6 +129,22 @@ feature '
|
||||
expect(page).to have_selector 'table#listing_orders tbody tr', count: 5 # Totals row per order
|
||||
end
|
||||
|
||||
scenario "Alphabetically Sorted Pack by Customer" do
|
||||
click_link "Pack By Customer"
|
||||
click_button 'Search'
|
||||
|
||||
rows = find("table#listing_orders").all("tr")
|
||||
table = rows.map { |r| r.all("th,td").map { |c| c.text.strip }[3] }
|
||||
expect(table).to eq([
|
||||
"Last Name",
|
||||
order2.bill_address.lastname,
|
||||
"",
|
||||
order1.bill_address.lastname,
|
||||
order1.bill_address.lastname,
|
||||
""
|
||||
])
|
||||
end
|
||||
|
||||
scenario "Pack By Supplier" do
|
||||
click_link "Pack By Supplier"
|
||||
fill_in 'q_completed_at_gt', with: '2013-04-25 13:00:00'
|
||||
|
||||
Reference in New Issue
Block a user