Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ import { MatStepperPrevious, MatStepperNext } from '@angular/material/stepper';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';

interface Account {
accountNumber: string;
}
Comment on lines +28 to +30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove the unused interface or align it with actual usage.

The Account interface is defined but never used in the component. Additionally, it only declares accountNumber but the filtering logic on line 203 relies on a gsimid property. Either remove this interface if it's not needed, or update it to match the actual account structure and apply it for type safety.

If you intend to use this interface for type safety, apply this diff:

 interface Account {
   accountNumber: string;
+  gsimid?: any; // Define proper type based on actual data structure
 }

Then use it in the filter:

-this.accountLinkingOptions = allOptions.filter((account: any) => account.gsimid);
+this.accountLinkingOptions = allOptions.filter((account: Account) => account.gsimid);

Or remove the interface entirely if not needed:

-interface Account {
-  accountNumber: string;
-}
-
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
interface Account {
accountNumber: string;
}
🤖 Prompt for AI Agents
In
src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts
around lines 28-30 and referencing the filter at line 203, the Account interface
is unused and its shape (only accountNumber) doesn’t match code which expects a
gsimid property; either remove the interface entirely if you don’t need it, or
update the interface to include the correct fields (e.g., gsimid and
accountNumber) and apply it to the account-related variables/arrays and the
filter so TypeScript enforces the correct shape (adjust the variable
declarations and filter predicate to use Account type).


/**
* Loans Account Details Step
*/
Expand Down Expand Up @@ -191,7 +195,13 @@ export class LoansAccountDetailsStepComponent implements OnInit, OnDestroy {
this.loanOfficerOptions = response.loanOfficerOptions;
this.loanPurposeOptions = response.loanPurposeOptions;
this.fundOptions = response.fundOptions;

this.accountLinkingOptions = response.accountLinkingOptions;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Remove the dead code assignment.

Line 199 assigns accountLinkingOptions from the response, but this value is immediately overwritten on line 203 by the filtered result. This assignment serves no purpose and should be removed.

Apply this diff:

 this.fundOptions = response.fundOptions;
-
-this.accountLinkingOptions = response.accountLinkingOptions;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts
around line 199, there is a dead assignment this.accountLinkingOptions =
response.accountLinkingOptions that is immediately overwritten later on line
203; remove this redundant assignment so accountLinkingOptions is only set once
to the filtered result, leaving the subsequent filter/assignment intact.


// Test - New Filter
const allOptions = response.accountLinkingOptions || [];
this.accountLinkingOptions = allOptions.filter((account: any) => account.gsimid);
Comment on lines +201 to +203
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "loans-account-details-step.component.ts" -type f | head -5

Repository: openMF/web-app

Length of output: 162


🏁 Script executed:

wc -l "./src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts"

Repository: openMF/web-app

Length of output: 166


🏁 Script executed:

cat -n "./src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts" | sed -n '195,210p'

Repository: openMF/web-app

Length of output: 889


🏁 Script executed:

head -n 50 "./src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts"

Repository: openMF/web-app

Length of output: 1706


🏁 Script executed:

grep -n "accountLinkingOptions\|response\|Account" "./src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts" | head -30

Repository: openMF/web-app

Length of output: 1733


🏁 Script executed:

grep -n "response\." "./src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts" | head -20

Repository: openMF/web-app

Length of output: 533


🏁 Script executed:

sed -n '180,215p' "./src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts"

Repository: openMF/web-app

Length of output: 1464


🏁 Script executed:

grep -n "interface\|export.*class\|private\|public" "./src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts" | head -40

Repository: openMF/web-app

Length of output: 424


🏁 Script executed:

rg "gsimid" --type ts | head -20

Repository: openMF/web-app

Length of output: 250


Remove test code and apply strict type safety to the account filter.

The code has two issues:

  1. Test code in production: The "Test - New Filter" comment indicates this filtering logic may not be finalized. Clarify whether this is ready for production or if it requires additional validation before merging.

  2. Type safety violation: The filter uses any type, which violates the coding guideline for strict type safety in Angular code. The existing Account interface lacks the gsimid property needed for filtering.

Update the interface to include the missing property:

 interface Account {
   accountNumber: string;
+  gsimid?: string;
 }

Then apply strict typing:

-// Test - New Filter
-const allOptions = response.accountLinkingOptions || [];
-this.accountLinkingOptions = allOptions.filter((account: any) => account.gsimid);
+const allOptions: Account[] = response.accountLinkingOptions || [];
+this.accountLinkingOptions = allOptions.filter((account: Account) => account.gsimid);

Verify:

  1. Is this filtering logic finalized and ready for production?
  2. What is the correct type for gsimid in your API response?

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts
around lines 201-203, remove the "Test - New Filter" comment and replace the
untyped filter with a strictly typed one: add the missing gsimid property to the
Account interface (set its type to the actual API type — string | number or
nullable variant as appropriate), update usages to use Account instead of any,
and filter with a null-safe check (e.g., account.gsimid != null) so the code is
type-safe; confirm the exact gsimid type from the API and use that type in the
interface before committing.


this.loanProductSelected = true;
if (response.createStandingInstructionAtDisbursement) {
this.loansAccountDetailsForm
Expand Down