Skip to content

Commit

Permalink
fix: Auto code the extracted vendor if org vendor list is empty (#3218)
Browse files Browse the repository at this point in the history
* add loop

* refactor

* replace at more places

* some fixes

* minor

* fix unit tests

* minor

* add check for empty vendor list
  • Loading branch information
harshal015 authored Oct 3, 2024
1 parent 14e8a11 commit f0ddadf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/fyle/add-edit-expense/add-edit-expense.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ export class AddEditExpensePage implements OnInit {

selectedCategory$: Observable<OrgCategory>;

vendorOptions: string[];
vendorOptions: string[] = [];

constructor(
private activatedRoute: ActivatedRoute,
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit f0ddadf

Please sign in to comment.