From ba6bc2b10779f3a2fb280f9040eb85ef87175ad7 Mon Sep 17 00:00:00 2001 From: Hugo Persson Date: Wed, 26 Jul 2023 19:33:27 +0200 Subject: [PATCH] Started work on fix. Found way to change total calculation. Need to tweak in account overview --- apps/api/src/app/portfolio/portfolio.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 859a2dd1c..dc4ec1713 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -1830,12 +1830,12 @@ export class PortfolioService { userId: string; withExcludedAccounts?: boolean; }) { - const ordersOfTypeItem = await this.orderService.getOrders({ + const ordersOfTypeItemOrLiability = await this.orderService.getOrders({ filters, userCurrency, userId, withExcludedAccounts, - types: ['ITEM'] + types: ['ITEM', 'LIABILITY'] }); const accounts: PortfolioDetails['accounts'] = {}; @@ -1875,7 +1875,7 @@ export class PortfolioService { return accountId === account.id; }); - const ordersOfTypeItemByAccount = ordersOfTypeItem.filter( + const ordersOfTypeItemByAccount = ordersOfTypeItemOrLiability.filter( ({ accountId }) => { return accountId === account.id; } @@ -1921,7 +1921,7 @@ export class PortfolioService { order.unitPrice ?? 0); - if (order.type === 'SELL') { + if (order.type === 'SELL' || order.type === 'LIABILITY') { currentValueOfSymbolInBaseCurrency *= -1; }