Browse Source

Refactoring

pull/2854/head
Thomas Kaul 2 years ago
parent
commit
e2b5121bd7
  1. 24
      apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts

24
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.marketDataDetails = marketData;
this.sectors = {}; this.sectors = {};
if (assetProfile?.countries?.length > 0) { if (this.assetProfile?.countries?.length > 0) {
for (const country of assetProfile.countries) { for (const { code, name, weight } of this.assetProfile.countries) {
this.countries[country.code] = { this.countries[code] = {
name: country.name, name,
value: country.weight value: weight
}; };
} }
} }
if (assetProfile?.sectors?.length > 0) { if (this.assetProfile?.sectors?.length > 0) {
for (const sector of assetProfile.sectors) { for (const { name, weight } of this.assetProfile.sectors) {
this.sectors[sector.name] = { this.sectors[name] = {
name: sector.name, name,
value: sector.weight value: weight
}; };
} }
} }
@ -144,7 +144,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
assetSubClass: this.assetProfile.assetSubClass ?? null, assetSubClass: this.assetProfile.assetSubClass ?? null,
comment: this.assetProfile?.comment ?? '', comment: this.assetProfile?.comment ?? '',
countries: JSON.stringify( countries: JSON.stringify(
assetProfile.countries.map(({ code, weight }) => { this.assetProfile?.countries.map(({ code, weight }) => {
return { code, weight }; return { code, weight };
}) ?? [] }) ?? []
), ),
@ -156,7 +156,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
scraperConfiguration: JSON.stringify( scraperConfiguration: JSON.stringify(
this.assetProfile?.scraperConfiguration ?? {} this.assetProfile?.scraperConfiguration ?? {}
), ),
sectors: JSON.stringify(assetProfile.sectors ?? []), sectors: JSON.stringify(this.assetProfile?.sectors ?? []),
symbolMapping: JSON.stringify(this.assetProfile?.symbolMapping ?? {}) symbolMapping: JSON.stringify(this.assetProfile?.symbolMapping ?? {})
}); });

Loading…
Cancel
Save