Browse Source

Code review fixes

pull/4352/head
csehatt741 2 months ago
committed by Attila Cseh
parent
commit
b03c84e6fd
  1. 4
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  2. 4
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts
  3. 4
      libs/common/src/lib/models/portfolio-snapshot.ts

4
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

@ -175,6 +175,7 @@ export abstract class PortfolioCalculator {
if (!transactionPoints.length) { if (!transactionPoints.length) {
return { return {
activitiesCount: 0,
currentValueInBaseCurrency: new Big(0), currentValueInBaseCurrency: new Big(0),
errors: [], errors: [],
hasErrors: false, hasErrors: false,
@ -185,8 +186,7 @@ export abstract class PortfolioCalculator {
totalInvestment: new Big(0), totalInvestment: new Big(0),
totalInvestmentWithCurrencyEffect: new Big(0), totalInvestmentWithCurrencyEffect: new Big(0),
totalLiabilitiesWithCurrencyEffect: new Big(0), totalLiabilitiesWithCurrencyEffect: new Big(0),
totalValuablesWithCurrencyEffect: new Big(0), totalValuablesWithCurrencyEffect: new Big(0)
activitiesCount: 0
}; };
} }

4
apps/api/src/app/portfolio/calculator/twr/portfolio-calculator.ts

@ -101,11 +101,11 @@ export class TWRPortfolioCalculator extends PortfolioCalculator {
totalInterestWithCurrencyEffect, totalInterestWithCurrencyEffect,
totalInvestment, totalInvestment,
totalInvestmentWithCurrencyEffect, totalInvestmentWithCurrencyEffect,
activitiesCount: this.activities.length,
errors: [], errors: [],
historicalData: [], historicalData: [],
totalLiabilitiesWithCurrencyEffect: new Big(0), totalLiabilitiesWithCurrencyEffect: new Big(0),
totalValuablesWithCurrencyEffect: new Big(0), totalValuablesWithCurrencyEffect: new Big(0)
activitiesCount: this.activities.length
}; };
} }

4
libs/common/src/lib/models/portfolio-snapshot.ts

@ -9,6 +9,8 @@ import { Big } from 'big.js';
import { Transform, Type } from 'class-transformer'; import { Transform, Type } from 'class-transformer';
export class PortfolioSnapshot { export class PortfolioSnapshot {
activitiesCount: number;
@Transform(transformToBig, { toClassOnly: true }) @Transform(transformToBig, { toClassOnly: true })
@Type(() => Big) @Type(() => Big)
currentValueInBaseCurrency: Big; currentValueInBaseCurrency: Big;
@ -45,6 +47,4 @@ export class PortfolioSnapshot {
@Transform(transformToBig, { toClassOnly: true }) @Transform(transformToBig, { toClassOnly: true })
@Type(() => Big) @Type(() => Big)
totalValuablesWithCurrencyEffect: Big; totalValuablesWithCurrencyEffect: Big;
activitiesCount: number;
} }

Loading…
Cancel
Save