load only enterprise fees connected to incoming exchanges on the OC

This commit is contained in:
Mohamed ABDELLANI
2023-08-02 18:25:38 +01:00
committed by Konrad
parent af525f9f7f
commit 4cb91da8b2
2 changed files with 10 additions and 14 deletions

View File

@@ -85,6 +85,7 @@ module Reporting
query = order
.all_adjustments
.enterprise_fee
.where(originator_id: enterprise_fees_related_to_incoming_exchanges_ids(order))
if enterprise_fee_filters?
query = query.where(originator_id: enterprise_fee_filtered_ids)
@@ -101,6 +102,15 @@ module Reporting
end
end
def enterprise_fees_related_to_incoming_exchanges_ids(order)
order
.order_cycle
.exchanges
.incoming
.flat_map(&:enterprise_fee_ids)
.uniq
end
def join_tax_rate
proc do |item|
tax_rate_ids = item[:order].all_adjustments.tax.where(

View File

@@ -276,8 +276,6 @@ describe "Enterprise Summary Fee with Tax Report By Producer" do
context "with line items from a single supplier" do
it 'generates the report and displays fees for the respective suppliers' do
pending "removal from distributor and coordinator fees from results"
login_as distributor_owner
visit admin_reports_path
click_on "Enterprise Fees With Tax Report By Producer"
@@ -315,8 +313,6 @@ describe "Enterprise Summary Fee with Tax Report By Producer" do
end
it "should filter by distributor and order cycle" do
pending "removal from distributor and coordinator fees from results"
page.find("#s2id_autogen1").click
find('li', text: distributor.name).click # selects Distributor
@@ -495,8 +491,6 @@ describe "Enterprise Summary Fee with Tax Report By Producer" do
end
it "should filter by distributor and order cycle" do
pending "removal from distributor and coordinator fees from results"
page.find("#s2id_autogen1").click
find('li', text: distributor.name).click # selects Distributor
@@ -531,8 +525,6 @@ describe "Enterprise Summary Fee with Tax Report By Producer" do
end
it "should filter by producer" do
pending "removal from distributor and coordinator fees from results"
page.find("#s2id_supplier_id_in").click
find('li', text: supplier2.name).click
@@ -705,8 +697,6 @@ describe "Enterprise Summary Fee with Tax Report By Producer" do
context "with line items from a single supplier" do
it 'generates the report and displays fees for the respective suppliers' do
pending "removal from distributor and coordinator fees from results"
login_as distributor_owner
visit admin_reports_path
click_on "Enterprise Fees With Tax Report By Producer"
@@ -849,8 +839,6 @@ describe "Enterprise Summary Fee with Tax Report By Producer" do
}
it 'should list all the tax rates' do
pending "removal from distributor and coordinator fees from results"
login_as distributor_owner
visit admin_reports_path
click_on "Enterprise Fees With Tax Report By Producer"
@@ -950,8 +938,6 @@ describe "Enterprise Summary Fee with Tax Report By Producer" do
}
it 'should list all the tax rates' do
pending "removal from distributor and coordinator fees from results"
login_as distributor_owner
visit admin_reports_path
click_on "Enterprise Fees With Tax Report By Producer"