mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Exclude $0 adjustments from report
This commit is contained in:
@@ -17,7 +17,7 @@ module OrderManagement
|
||||
end
|
||||
|
||||
def result
|
||||
group_data.select_attributes
|
||||
group_data.exclude_groups_with_zero_total.select_attributes
|
||||
@scope.all
|
||||
end
|
||||
|
||||
@@ -336,6 +336,10 @@ module OrderManagement
|
||||
if params.payment_method_ids.present?
|
||||
end
|
||||
|
||||
def exclude_groups_with_zero_total
|
||||
filter_scope("spree_adjustments.amount != 0")
|
||||
end
|
||||
|
||||
def group_data
|
||||
chain_to_scope do
|
||||
group("enterprise_fees.id", "enterprises.id", "customers.id", "hubs.id",
|
||||
|
||||
@@ -225,11 +225,9 @@ describe OrderManagement::Reports::EnterpriseFeeSummary::ReportService do
|
||||
it "is included" do
|
||||
totals = service.list
|
||||
|
||||
expect(totals.length).to eq(2)
|
||||
expect(totals.length).to eq(1)
|
||||
|
||||
expected_result = [
|
||||
["Payment Transaction", "Sample Distributor", "Sample Payment Method", "Sample Customer",
|
||||
nil, nil, nil, "0.00"],
|
||||
["Shipment", "Sample Distributor", "Sample Shipping Method", "Sample Customer",
|
||||
nil, nil, "Platform Rate", "1.00"]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user