From 278a72e373e0d62ea1b3f8ad0a3de8aedc281f8e Mon Sep 17 00:00:00 2001 From: Suyash Patil <127177049+suyashpatil78@users.noreply.github.com> Date: Fri, 28 Jun 2024 16:15:39 +0530 Subject: [PATCH] fix: Do not show pending transactions to add to report (#3122) --- src/app/fyle/my-expenses/my-expenses.page.spec.ts | 5 +++++ src/app/fyle/my-expenses/my-expenses.page.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/fyle/my-expenses/my-expenses.page.spec.ts b/src/app/fyle/my-expenses/my-expenses.page.spec.ts index 53dfcc80f8..cd66fdf62b 100644 --- a/src/app/fyle/my-expenses/my-expenses.page.spec.ts +++ b/src/app/fyle/my-expenses/my-expenses.page.spec.ts @@ -308,6 +308,7 @@ describe('MyExpensesPage', () => { 'getDeleteDialogBody', 'restrictPendingTransactionsEnabled', 'doesExpenseHavePendingCardTransaction', + 'getReportableExpenses', ]); const utilityServiceSpy = jasmine.createSpyObj('UtilityService', [ 'canShowOptInAfterExpenseCreation', @@ -2914,6 +2915,10 @@ describe('MyExpensesPage', () => { queryParams: { report_id: 'is.null', state: 'in.(COMPLETE,DRAFT)', q: 'Bus:*' }, }); expect(sharedExpenseService.excludeCCCExpenses).toHaveBeenCalledOnceWith(apiExpenses1); + expect(sharedExpenseService.getReportableExpenses).toHaveBeenCalledOnceWith( + component.selectedElements, + component.restrictPendingTransactionsEnabled + ); expect(component.cccExpenses).toBe(0); expect(component.selectedElements).toEqual([...apiExpenses1]); expect(component.allExpensesCount).toBe(2); diff --git a/src/app/fyle/my-expenses/my-expenses.page.ts b/src/app/fyle/my-expenses/my-expenses.page.ts index 0862168582..ca0f5171a4 100644 --- a/src/app/fyle/my-expenses/my-expenses.page.ts +++ b/src/app/fyle/my-expenses/my-expenses.page.ts @@ -1626,7 +1626,10 @@ export class MyExpensesPage implements OnInit { } this.allExpensesCount = this.selectedElements.length; this.isReportableExpensesSelected = - this.sharedExpenseService.getReportableExpenses(this.selectedElements).length > 0; + this.sharedExpenseService.getReportableExpenses( + this.selectedElements, + this.restrictPendingTransactionsEnabled + ).length > 0; this.setExpenseStatsOnSelect(); }); }