fetch variant enterprise fees from order lineitems adjustments #11529

This commit is contained in:
Abdul Aziz Ali
2025-01-21 06:53:42 +08:00
parent c25fe6ae57
commit a15cb58ab5
2 changed files with 3 additions and 6 deletions

View File

@@ -161,11 +161,9 @@ module Reporting
# { variant: [enterprise_fee_ids] }
def enterprise_fees_per_variant(order)
hash = {}
order.order_cycle.exchanges.each do |exchange|
exchange.variants.each do |variant|
hash[variant] ||= order.order_cycle.coordinator_fee_ids
hash[variant] += exchange.enterprise_fee_ids
end
order.line_items.each do |li|
hash[li.variant] ||= order.order_cycle.coordinator_fee_ids
hash[li.variant] += li.adjustments.enterprise_fee.map(&:originator_id)
end
hash
end

View File

@@ -55,7 +55,6 @@ RSpec.describe Reporting::Reports::EnterpriseFeeSummary::EnterpriseFeesWithTaxRe
report = described_class.new(current_user)
pending "https://github.com/openfoodfoundation/openfoodnetwork/issues/11529"
expect(report.query_result.values).to eq [[order]]
end
end