From e2b5121bd79e54564533ad7c9cad3d019ce2e62a Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Wed, 17 Jan 2024 11:25:44 +0100 Subject: [PATCH] Refactoring --- .../asset-profile-dialog.component.ts | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts index 200e2a826..f949d9e41 100644 --- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts +++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts @@ -121,20 +121,20 @@ export class AssetProfileDialog implements OnDestroy, OnInit { this.marketDataDetails = marketData; this.sectors = {}; - if (assetProfile?.countries?.length > 0) { - for (const country of assetProfile.countries) { - this.countries[country.code] = { - name: country.name, - value: country.weight + if (this.assetProfile?.countries?.length > 0) { + for (const { code, name, weight } of this.assetProfile.countries) { + this.countries[code] = { + name, + value: weight }; } } - if (assetProfile?.sectors?.length > 0) { - for (const sector of assetProfile.sectors) { - this.sectors[sector.name] = { - name: sector.name, - value: sector.weight + if (this.assetProfile?.sectors?.length > 0) { + for (const { name, weight } of this.assetProfile.sectors) { + this.sectors[name] = { + name, + value: weight }; } } @@ -144,7 +144,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { assetSubClass: this.assetProfile.assetSubClass ?? null, comment: this.assetProfile?.comment ?? '', countries: JSON.stringify( - assetProfile.countries.map(({ code, weight }) => { + this.assetProfile?.countries.map(({ code, weight }) => { return { code, weight }; }) ?? [] ), @@ -156,7 +156,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { scraperConfiguration: JSON.stringify( this.assetProfile?.scraperConfiguration ?? {} ), - sectors: JSON.stringify(assetProfile.sectors ?? []), + sectors: JSON.stringify(this.assetProfile?.sectors ?? []), symbolMapping: JSON.stringify(this.assetProfile?.symbolMapping ?? {}) });