From 3f0677946f1f4e8b15ca07116b814401eab8d405 Mon Sep 17 00:00:00 2001 From: Brandon Wortman Date: Wed, 18 Dec 2024 17:52:09 -0500 Subject: [PATCH] #3955 Make constructor public and handle empty emergency fund input If negative, fallback to defaultValue. If empty/user deletes entry, fallback to 0. --- .../portfolio-summary/portfolio-summary.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts index db23d10b1..53bae9da4 100644 --- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts +++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.ts @@ -35,7 +35,7 @@ export class PortfolioSummaryComponent implements OnChanges { ); public timeInMarket: string; - constructor(private notificationService: NotificationService) {} + public constructor(private notificationService: NotificationService) {} public ngOnChanges() { if (this.summary) { @@ -54,7 +54,8 @@ export class PortfolioSummaryComponent implements OnChanges { public onEditEmergencyFund() { this.notificationService.prompt({ confirmFn: (value) => { - const emergencyFund = parseFloat(value.trim()); + // If empty/deleted value by user, default to 0. + const emergencyFund = parseFloat(value.trim()) || 0; if (emergencyFund >= 0) { this.emergencyFundChanged.emit(emergencyFund); }