From e2094665c5f94f70b4139222fc42b366dd709a5d Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Tue, 4 Jul 2023 10:00:20 +0100 Subject: [PATCH] Update enterprise fee report tax_category fetching --- lib/reporting/reports/enterprise_fee_summary/scope.rb | 2 +- .../enterprise_fee_summary_report_spec.rb | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/reporting/reports/enterprise_fee_summary/scope.rb b/lib/reporting/reports/enterprise_fee_summary/scope.rb index 651ecbb035..24ea2a3b6f 100644 --- a/lib/reporting/reports/enterprise_fee_summary/scope.rb +++ b/lib/reporting/reports/enterprise_fee_summary/scope.rb @@ -236,7 +236,7 @@ module Reporting LEFT OUTER JOIN spree_tax_categories AS product_tax_categories ON ( enterprise_fees.inherits_tax_category IS TRUE - AND product_tax_categories.id = spree_products.tax_category_id + AND product_tax_categories.id = spree_variants.tax_category_id ) JOIN_STRING ) diff --git a/spec/lib/reports/enterprise_fee_summary/enterprise_fee_summary_report_spec.rb b/spec/lib/reports/enterprise_fee_summary/enterprise_fee_summary_report_spec.rb index 939b1ae1a0..4a30f5b7dc 100644 --- a/spec/lib/reports/enterprise_fee_summary/enterprise_fee_summary_report_spec.rb +++ b/spec/lib/reports/enterprise_fee_summary/enterprise_fee_summary_report_spec.rb @@ -31,9 +31,9 @@ describe Reporting::Reports::EnterpriseFeeSummary::FeeSummary do # Set up other requirements for ordering. let!(:order_cycle) { create(:simple_order_cycle, coordinator: coordinator) } - let!(:product) { create(:product, tax_category: product_tax_category) } + let!(:product) { create(:product) } let!(:product_tax_category) { create(:tax_category, name: "Sample Product Tax") } - let!(:variant) { prepare_variant } + let!(:variant) { prepare_variant(tax_category: product_tax_category) } # Create customers. let!(:customer) { create(:customer, first_name: "Sample", last_name: "Customer") } @@ -54,7 +54,8 @@ describe Reporting::Reports::EnterpriseFeeSummary::FeeSummary do end let!(:variant) do - prepare_variant(incoming_exchange_fees: variant_incoming_exchange_fees, + prepare_variant(tax_category: product_tax_category, + incoming_exchange_fees: variant_incoming_exchange_fees, outgoing_exchange_fees: variant_outgoing_exchange_fees) end