Exclude $0 adjustments from report

This commit is contained in:
Kristina Lim
2019-02-18 16:52:40 +08:00
parent 36fd385f7d
commit b0a82b0e21
2 changed files with 6 additions and 4 deletions

View File

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

View File

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