Bugfix/fix issue with holdings and sectors while using symbol profile overrides (#4234)
* Fix issue with holdings and sectors while using symbol profile overrides * Update changelog
This commit is contained in:
parent
512b84016c
commit
4cb4375514
@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed an issue with the detection of the thousand separator by locale
|
- Fixed an issue with the detection of the thousand separator by locale
|
||||||
|
- Fixed an issue with holdings and sectors while using symbol profile overrides
|
||||||
- Fixed an issue with the MIME type detection in the scraper configuration
|
- Fixed an issue with the MIME type detection in the scraper configuration
|
||||||
|
|
||||||
## 2.135.0 - 2025-01-19
|
## 2.135.0 - 2025-01-19
|
||||||
|
@ -177,9 +177,13 @@ export class SymbolProfileService {
|
|||||||
symbolProfile?.countries as unknown as Prisma.JsonArray
|
symbolProfile?.countries as unknown as Prisma.JsonArray
|
||||||
),
|
),
|
||||||
dateOfFirstActivity: undefined as Date,
|
dateOfFirstActivity: undefined as Date,
|
||||||
holdings: this.getHoldings(symbolProfile),
|
holdings: this.getHoldings(
|
||||||
|
symbolProfile?.holdings as unknown as Prisma.JsonArray
|
||||||
|
),
|
||||||
scraperConfiguration: this.getScraperConfiguration(symbolProfile),
|
scraperConfiguration: this.getScraperConfiguration(symbolProfile),
|
||||||
sectors: this.getSectors(symbolProfile),
|
sectors: this.getSectors(
|
||||||
|
symbolProfile?.sectors as unknown as Prisma.JsonArray
|
||||||
|
),
|
||||||
symbolMapping: this.getSymbolMapping(symbolProfile)
|
symbolMapping: this.getSymbolMapping(symbolProfile)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -209,8 +213,9 @@ export class SymbolProfileService {
|
|||||||
(item.SymbolProfileOverrides.holdings as unknown as Holding[])
|
(item.SymbolProfileOverrides.holdings as unknown as Holding[])
|
||||||
?.length > 0
|
?.length > 0
|
||||||
) {
|
) {
|
||||||
item.holdings = item.SymbolProfileOverrides
|
item.holdings = this.getHoldings(
|
||||||
.holdings as unknown as Holding[];
|
item.SymbolProfileOverrides?.holdings as unknown as Prisma.JsonArray
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
item.name = item.SymbolProfileOverrides?.name ?? item.name;
|
item.name = item.SymbolProfileOverrides?.name ?? item.name;
|
||||||
@ -219,8 +224,9 @@ export class SymbolProfileService {
|
|||||||
(item.SymbolProfileOverrides.sectors as unknown as Sector[])?.length >
|
(item.SymbolProfileOverrides.sectors as unknown as Sector[])?.length >
|
||||||
0
|
0
|
||||||
) {
|
) {
|
||||||
item.sectors = item.SymbolProfileOverrides
|
item.sectors = this.getSectors(
|
||||||
.sectors as unknown as Sector[];
|
item.SymbolProfileOverrides?.sectors as unknown as Prisma.JsonArray
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
item.url = item.SymbolProfileOverrides?.url ?? item.url;
|
item.url = item.SymbolProfileOverrides?.url ?? item.url;
|
||||||
@ -249,18 +255,20 @@ export class SymbolProfileService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getHoldings(symbolProfile: SymbolProfile): Holding[] {
|
private getHoldings(aHoldings: Prisma.JsonArray = []): Holding[] {
|
||||||
return ((symbolProfile?.holdings as Prisma.JsonArray) ?? []).map(
|
if (aHoldings === null) {
|
||||||
(holding) => {
|
return [];
|
||||||
const { name, weight } = holding as Prisma.JsonObject;
|
}
|
||||||
|
|
||||||
return {
|
return aHoldings.map((holding) => {
|
||||||
allocationInPercentage: weight as number,
|
const { name, weight } = holding as Prisma.JsonObject;
|
||||||
name: (name as string) ?? UNKNOWN_KEY,
|
|
||||||
valueInBaseCurrency: undefined
|
return {
|
||||||
};
|
allocationInPercentage: weight as number,
|
||||||
}
|
name: (name as string) ?? UNKNOWN_KEY,
|
||||||
);
|
valueInBaseCurrency: undefined
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getScraperConfiguration(
|
private getScraperConfiguration(
|
||||||
@ -285,17 +293,19 @@ export class SymbolProfileService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSectors(symbolProfile: SymbolProfile): Sector[] {
|
private getSectors(aSectors: Prisma.JsonArray = []): Sector[] {
|
||||||
return ((symbolProfile?.sectors as Prisma.JsonArray) ?? []).map(
|
if (aSectors === null) {
|
||||||
(sector) => {
|
return [];
|
||||||
const { name, weight } = sector as Prisma.JsonObject;
|
}
|
||||||
|
|
||||||
return {
|
return aSectors.map((sector) => {
|
||||||
name: (name as string) ?? UNKNOWN_KEY,
|
const { name, weight } = sector as Prisma.JsonObject;
|
||||||
weight: weight as number
|
|
||||||
};
|
return {
|
||||||
}
|
name: (name as string) ?? UNKNOWN_KEY,
|
||||||
);
|
weight: weight as number
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSymbolMapping(symbolProfile: SymbolProfile) {
|
private getSymbolMapping(symbolProfile: SymbolProfile) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export interface Holding {
|
export interface Holding {
|
||||||
allocationInPercentage?: number;
|
allocationInPercentage: number;
|
||||||
name: string;
|
name: string;
|
||||||
valueInBaseCurrency: number;
|
valueInBaseCurrency: number;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user