diff --git a/apps/api/src/app/portfolio/portfolio.service-new.ts b/apps/api/src/app/portfolio/portfolio.service-new.ts index 6ab74730a..f11909b85 100644 --- a/apps/api/src/app/portfolio/portfolio.service-new.ts +++ b/apps/api/src/app/portfolio/portfolio.service-new.ts @@ -302,7 +302,6 @@ export class PortfolioServiceNew { aDateRange: DateRange = 'max' ): Promise { const userId = await this.getUserId(aImpersonationId, aUserId); - const user = await this.userService.user({ id: userId }); const emergencyFund = new Big( @@ -896,6 +895,7 @@ export class PortfolioServiceNew { public async getSummary(aImpersonationId: string): Promise { const userCurrency = this.request.user.Settings.currency; const userId = await this.getUserId(aImpersonationId, this.request.user.id); + const user = await this.userService.user({ id: userId }); const performanceInformation = await this.getPerformance(aImpersonationId); @@ -908,9 +908,9 @@ export class PortfolioServiceNew { userId }); const dividend = this.getDividend(orders).toNumber(); - const emergencyFund = - (this.request.user?.Settings?.settings as UserSettings)?.emergencyFund ?? - 0; + const emergencyFund = new Big( + (user.Settings?.settings as UserSettings)?.emergencyFund ?? 0 + ); const fees = this.getFees(orders).toNumber(); const firstOrderDate = orders[0]?.date; const items = this.getItems(orders).toNumber(); @@ -946,7 +946,6 @@ export class PortfolioServiceNew { annualizedPerformancePercent, cash, dividend, - emergencyFund, fees, firstOrderDate, items, @@ -954,6 +953,7 @@ export class PortfolioServiceNew { totalBuy, totalSell, committedFunds: committedFunds.toNumber(), + emergencyFund: emergencyFund.toNumber(), ordersCount: orders.filter((order) => { return order.type === 'BUY' || order.type === 'SELL'; }).length diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 68a46c48a..f7902a2d7 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -293,7 +293,6 @@ export class PortfolioService { aDateRange: DateRange = 'max' ): Promise { const userId = await this.getUserId(aImpersonationId, aUserId); - const user = await this.userService.user({ id: userId }); const emergencyFund = new Big( @@ -874,6 +873,7 @@ export class PortfolioService { public async getSummary(aImpersonationId: string): Promise { const userCurrency = this.request.user.Settings.currency; const userId = await this.getUserId(aImpersonationId, this.request.user.id); + const user = await this.userService.user({ id: userId }); const performanceInformation = await this.getPerformance(aImpersonationId); @@ -886,9 +886,9 @@ export class PortfolioService { userId }); const dividend = this.getDividend(orders).toNumber(); - const emergencyFund = - (this.request.user?.Settings?.settings as UserSettings)?.emergencyFund ?? - 0; + const emergencyFund = new Big( + (user.Settings?.settings as UserSettings)?.emergencyFund ?? 0 + ); const fees = this.getFees(orders).toNumber(); const firstOrderDate = orders[0]?.date; const items = this.getItems(orders).toNumber(); @@ -908,7 +908,6 @@ export class PortfolioService { ...performanceInformation.performance, cash, dividend, - emergencyFund, fees, firstOrderDate, items, @@ -918,6 +917,7 @@ export class PortfolioService { annualizedPerformancePercent: performanceInformation.performance.annualizedPerformancePercent, committedFunds: committedFunds.toNumber(), + emergencyFund: emergencyFund.toNumber(), ordersCount: orders.filter((order) => { return order.type === 'BUY' || order.type === 'SELL'; }).length diff --git a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html index b47ebf4aa..5335b77a7 100644 --- a/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html +++ b/apps/client/src/app/components/portfolio-summary/portfolio-summary.component.html @@ -140,7 +140,7 @@