From 49c3e610e3d5d1cf620264a14f13b2373eadada2 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 7 Jun 2024 21:36:03 +0200 Subject: [PATCH] Handle impersonation and restricted view --- .../allocations/allocations-page.component.ts | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) 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 4ebe07287..f8ad447de 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 @@ -505,7 +505,11 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { } } - if (this.positions[symbol].assetSubClass === 'ETF') { + if ( + this.positions[symbol].assetSubClass === 'ETF' && + !this.hasImpersonationId && + !this.user.settings.isRestrictedView + ) { this.totalValueInEtf += this.positions[symbol].value; } @@ -553,18 +557,20 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { this.markets[UNKNOWN_KEY].value = this.markets[UNKNOWN_KEY].value / marketsTotal; - this.topHoldings = Object.values(this.topHoldingsMap) - .map(({ name, value }) => { - return { - name, - allocationInPercentage: - this.totalValueInEtf > 0 ? value / this.totalValueInEtf : 0, - valueInBaseCurrency: value - }; - }) - .sort((a, b) => { - return b.valueInBaseCurrency - a.valueInBaseCurrency; - }); + if (!this.hasImpersonationId && !this.user.settings.isRestrictedView) { + this.topHoldings = Object.values(this.topHoldingsMap) + .map(({ name, value }) => { + return { + name, + allocationInPercentage: + this.totalValueInEtf > 0 ? value / this.totalValueInEtf : 0, + valueInBaseCurrency: value + }; + }) + .sort((a, b) => { + return b.valueInBaseCurrency - a.valueInBaseCurrency; + }); + } } private openAccountDetailDialog(aAccountId: string) {