From a5fa8b59b8ed938ca250435051b1e7546878f1a2 Mon Sep 17 00:00:00 2001 From: Harshal Devmurari <92778686+harshal015@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:16:18 +0530 Subject: [PATCH] fix: Auto code the extracted vendor if org vendor list is empty (#3218) * add loop * refactor * replace at more places * some fixes * minor * fix unit tests * minor * add check for empty vendor list --- src/app/fyle/add-edit-expense/add-edit-expense.page.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts index de4e2ed6b7..b278216a1c 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts @@ -439,7 +439,7 @@ export class AddEditExpensePage implements OnInit { selectedCategory$: Observable; - vendorOptions: string[]; + vendorOptions: string[] = []; constructor( private activatedRoute: ActivatedRoute, @@ -4556,6 +4556,9 @@ export class AddEditExpensePage implements OnInit { } private filterVendor(vendor: string): string | null { + if (!vendor || this.vendorOptions?.length === 0) { + return vendor; + } return this.vendorOptions?.find((option) => option.toLowerCase() === vendor.toLowerCase()) || null; }