-
Notifications
You must be signed in to change notification settings - Fork 903
WEB-670: Working Capital loan delinquency grace days #3440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,28 +11,35 @@ import { Injectable, inject } from '@angular/core'; | |
| import { ActivatedRouteSnapshot } from '@angular/router'; | ||
|
|
||
| /** rxjs Imports */ | ||
| import { Observable } from 'rxjs'; | ||
| import { EMPTY, Observable } from 'rxjs'; | ||
|
|
||
| /** Custom Services */ | ||
| import { LoansService } from '../loans.service'; | ||
| import { LoanProductService } from 'app/products/loan-products/services/loan-product.service'; | ||
| import { LoanBaseResolver } from './loan-base.resolver'; | ||
|
|
||
| /** | ||
| * Loan accounts template data resolver. | ||
| */ | ||
| @Injectable() | ||
| export class LoansAccountAndTemplateResolver { | ||
| export class LoansAccountAndTemplateResolver extends LoanBaseResolver { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This branch can select the wrong API after a previous navigation.
Suggested change resolve(route: ActivatedRouteSnapshot): Observable<any> {
- this.initialize(route);
- const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId');
- if (!isNaN(+loanId)) {
- return this.isLoanProduct
+ const productType = route.queryParamMap.get('productType');
+ const isLoanProduct = productType !== 'working-capital';
+ const loanId = route.paramMap.get('loanId') ?? route.parent?.paramMap.get('loanId');
+ if (loanId !== null && loanId.trim() !== '' && !Number.isNaN(Number(loanId))) {
+ return isLoanProduct
? this.loansService.getLoansAccountAndTemplateResource(loanId)
: this.loansService.getWorkingCapitalLoanDetails(loanId);
}
return EMPTY;
}Also applies to: 36-43 🤖 Prompt for AI Agents |
||
| private loansService = inject(LoansService); | ||
| private loanProductService = inject(LoanProductService); | ||
|
|
||
| constructor() { | ||
| super(); | ||
| } | ||
|
|
||
| /** | ||
| * Returns the loan account template data. | ||
| * @returns {Observable<any>} | ||
| */ | ||
| resolve(route: ActivatedRouteSnapshot): Observable<any> { | ||
| this.initialize(route); | ||
| const loanId = route.paramMap.get('loanId') || route.parent.paramMap.get('loanId'); | ||
| return this.loanProductService.isLoanProduct | ||
| ? this.loansService.getLoansAccountAndTemplateResource(loanId) | ||
| : this.loansService.getWorkingCapitalLoanDetails(loanId); | ||
| if (!isNaN(+loanId)) { | ||
| return this.isLoanProduct | ||
| ? this.loansService.getLoansAccountAndTemplateResource(loanId) | ||
| : this.loansService.getWorkingCapitalLoanDetails(loanId); | ||
| } | ||
| return EMPTY; | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -107,6 +107,20 @@ <h3 class="mat-h3 margin-t flex-fill">{{ 'labels.heading.Terms' | translate }}</ | |||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @if (loansAccount.delinquencyGraceDays) { | ||||||||||||||||||||||||||
| <div class="flex-fill"> | ||||||||||||||||||||||||||
| <span class="flex-30">{{ 'labels.inputs.Delinquency Grace Days' | translate }}:</span> | ||||||||||||||||||||||||||
| <span class="flex-70"> {{ loansAccount.delinquencyGraceDays | formatNumber }}</span> | ||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
Comment on lines
+110
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Render Line 110 uses a truthy check, so a valid value of 🔧 Suggested fix- `@if` (loansAccount.delinquencyGraceDays) {
+ `@if` (loansAccount.delinquencyGraceDays !== null && loansAccount.delinquencyGraceDays !== undefined) {
<div class="flex-fill">
<span class="flex-30">{{ 'labels.inputs.Delinquency Grace Days' | translate }}:</span>
<span class="flex-70"> {{ loansAccount.delinquencyGraceDays | formatNumber }}</span>
</div>
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @if (loansAccount.delinquencyStartType) { | ||||||||||||||||||||||||||
| <div class="flex-fill"> | ||||||||||||||||||||||||||
| <span class="flex-30">{{ 'labels.inputs.Delinquency Start Type' | translate }}:</span> | ||||||||||||||||||||||||||
| <span class="flex-60">{{ camalize(loansAccount.delinquencyStartType) | translateKey: 'catalogs' }}</span> | ||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <div class="flex-fill"> | ||||||||||||||||||||||||||
| <span class="flex-30">{{ 'labels.inputs.Period Payment Rate' | translate }}:</span> | ||||||||||||||||||||||||||
| <span class="flex-70"> {{ loansAccount.periodPaymentRate | formatNumber }} % </span> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: openMF/web-app
Length of output: 1054
🏁 Script executed:
rg -A 10 'getLoanOriginators' src/app/loans --type tsRepository: openMF/web-app
Length of output: 1548
🏁 Script executed:
rg -B 5 -A 10 'loanOriginatorsData' src/app/loans --type tsRepository: openMF/web-app
Length of output: 4964
🏁 Script executed:
Repository: openMF/web-app
Length of output: 2458
Return an observable on the non-loan-product path to prevent undefined resolver data.
The
resolve()method falls through without returning an observable whenthis.loanProductService.isLoanProductis false. This violates theObservable<any>return contract and causes the component to fail when it attempts to dereferencedata.loanOriginatorsData.originatorson an undefined value.Return a fallback observable that matches the expected API response structure:
Suggested fix
🤖 Prompt for AI Agents