Browse Source

Fix GroupBy for investment

pull/5027/head
Daniel Devaud 1 year ago
parent
commit
d56d6f944f
  1. 15
      apps/api/src/app/portfolio/portfolio.service.ts

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

@ -317,14 +317,21 @@ export class PortfolioService {
withDataDecimation: false withDataDecimation: false
}); });
let investments = items.map( let investments: InvestmentItem[];
({ date, investmentValueWithCurrencyEffect }) => {
if (groupBy) {
investments = portfolioCalculator.getInvestmentsByGroup({
groupBy,
data: items
});
} else {
investments = items.map(({ date, investmentValueWithCurrencyEffect }) => {
return { return {
date, date,
investment: investmentValueWithCurrencyEffect investment: investmentValueWithCurrencyEffect
}; };
} });
); }
let streaks: PortfolioInvestments['streaks']; let streaks: PortfolioInvestments['streaks'];

Loading…
Cancel
Save