Browse Source

Started work on fix. Found way to change total calculation. Need to tweak in account overview

pull/2184/head
Hugo Persson 2 years ago
parent
commit
ba6bc2b107
  1. 8
      apps/api/src/app/portfolio/portfolio.service.ts

8
apps/api/src/app/portfolio/portfolio.service.ts

@ -1830,12 +1830,12 @@ export class PortfolioService {
userId: string; userId: string;
withExcludedAccounts?: boolean; withExcludedAccounts?: boolean;
}) { }) {
const ordersOfTypeItem = await this.orderService.getOrders({ const ordersOfTypeItemOrLiability = await this.orderService.getOrders({
filters, filters,
userCurrency, userCurrency,
userId, userId,
withExcludedAccounts, withExcludedAccounts,
types: ['ITEM'] types: ['ITEM', 'LIABILITY']
}); });
const accounts: PortfolioDetails['accounts'] = {}; const accounts: PortfolioDetails['accounts'] = {};
@ -1875,7 +1875,7 @@ export class PortfolioService {
return accountId === account.id; return accountId === account.id;
}); });
const ordersOfTypeItemByAccount = ordersOfTypeItem.filter( const ordersOfTypeItemByAccount = ordersOfTypeItemOrLiability.filter(
({ accountId }) => { ({ accountId }) => {
return accountId === account.id; return accountId === account.id;
} }
@ -1921,7 +1921,7 @@ export class PortfolioService {
order.unitPrice ?? order.unitPrice ??
0); 0);
if (order.type === 'SELL') { if (order.type === 'SELL' || order.type === 'LIABILITY') {
currentValueOfSymbolInBaseCurrency *= -1; currentValueOfSymbolInBaseCurrency *= -1;
} }

Loading…
Cancel
Save