diff --git a/CHANGELOG.md b/CHANGELOG.md index 00d1c71dfe..b4d9031a0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed the colors of the investment chart component (dark mode) - Fixed the colors of the charts if the appearance is set to light and the operating system uses dark mode - Fixed the allocation column of the top holdings of ETFs on the allocations page after a change of the user settings +- Fixed the allocation column of the top holdings of funds other than ETFs on the allocations page - Fixed the value column of the top holdings of ETFs on the allocations page in the _Presenter View_ - Fixed the projected sustainable retirement income on the _FIRE_ page for a projected total amount of zero (experimental) - Fixed the sustainable retirement income on the _FIRE_ page for redacted values diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts index 647bc761e3..cbdacaa3f1 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts @@ -130,7 +130,7 @@ export class GfAllocationsPageComponent implements OnInit { value: number; }; }; - protected topHoldings: HoldingWithParents[]; + protected topHoldings: HoldingWithParents[] | undefined; protected readonly UNKNOWN_KEY = UNKNOWN_KEY; protected user: User; @@ -360,6 +360,7 @@ export class GfAllocationsPageComponent implements OnInit { value: 0 } }; + this.topHoldings = undefined; } private initializeAllocationsData() { @@ -387,7 +388,7 @@ export class GfAllocationsPageComponent implements OnInit { } = {}; let totalValueExcludingCashPositions = 0; - let totalValueInEtf = 0; + let totalValueInFunds = 0; for (const position of this.portfolioDetails.holdings) { const assetProfileIdentifier = getAssetProfileIdentifier( @@ -463,6 +464,8 @@ export class GfAllocationsPageComponent implements OnInit { } if (position.assetProfile.holdings.length > 0) { + totalValueInFunds += this.holdings[assetProfileIdentifier].value; + for (const { allocationInPercentage, name, @@ -513,10 +516,6 @@ export class GfAllocationsPageComponent implements OnInit { } } - if (this.holdings[assetProfileIdentifier].assetSubClass === 'ETF') { - totalValueInEtf += this.holdings[assetProfileIdentifier].value; - } - const symbol = position.assetProfile.symbol; const value = this.extractValue(position); @@ -593,7 +592,7 @@ export class GfAllocationsPageComponent implements OnInit { return { name, allocationInPercentage: - totalValueInEtf > 0 ? value / totalValueInEtf : 0, + totalValueInFunds > 0 ? value / totalValueInFunds : 0, parents: this.portfolioDetails.holdings .map((holding) => { if (holding.assetProfile.holdings.length > 0) { @@ -610,7 +609,9 @@ export class GfAllocationsPageComponent implements OnInit { isNumber(currentParentHolding.valueInBaseCurrency) ? { allocationInPercentage: - currentParentHolding.valueInBaseCurrency / value, + value > 0 + ? currentParentHolding.valueInBaseCurrency / value + : 0, name: holding.assetProfile.name ?? '', position: holding, symbol: holding.assetProfile.symbol,