From 48b2d79aee494a0cd444d8caa03531de5ece9a08 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Mon, 28 Mar 2022 20:50:13 +0200 Subject: [PATCH] Fix currency conversion (duplicate) --- apps/api/src/app/portfolio/portfolio.service-new.ts | 12 ++++++------ apps/api/src/app/portfolio/portfolio.service.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio.service-new.ts b/apps/api/src/app/portfolio/portfolio.service-new.ts index 63b8544a8..c01f30242 100644 --- a/apps/api/src/app/portfolio/portfolio.service-new.ts +++ b/apps/api/src/app/portfolio/portfolio.service-new.ts @@ -111,21 +111,21 @@ export class PortfolioServiceNew { } } - const value = details.accounts[account.id]?.current ?? 0; + const valueInBaseCurrency = details.accounts[account.id]?.current ?? 0; const result = { ...account, transactionCount, - value, + valueInBaseCurrency, balanceInBaseCurrency: this.exchangeRateDataService.toCurrency( account.balance, account.currency, userCurrency ), - valueInBaseCurrency: this.exchangeRateDataService.toCurrency( - value, - account.currency, - userCurrency + value: this.exchangeRateDataService.toCurrency( + valueInBaseCurrency, + userCurrency, + account.currency ) }; diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index a00b0cabd..f8e617432 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -106,21 +106,21 @@ export class PortfolioService { } } - const value = details.accounts[account.id]?.current ?? 0; + const valueInBaseCurrency = details.accounts[account.id]?.current ?? 0; const result = { ...account, transactionCount, - value, + valueInBaseCurrency, balanceInBaseCurrency: this.exchangeRateDataService.toCurrency( account.balance, account.currency, userCurrency ), - valueInBaseCurrency: this.exchangeRateDataService.toCurrency( - value, - account.currency, - userCurrency + value: this.exchangeRateDataService.toCurrency( + valueInBaseCurrency, + userCurrency, + account.currency ) };