mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-09 03:20:21 +00:00
fetch variant enterprise fees from order lineitems adjustments #11529
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user