Bugfix/fix issue with symbol profile overrides in historical market data table of admin control panel (#4339)

* Respect symbol profile overrides in market data controller (GET)

* Update changelog
This commit is contained in:
Thomas Kaul 2025-02-20 19:40:27 +01:00 committed by GitHub
parent 46878ea5a8
commit 69a0de28cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 40 additions and 12 deletions

View File

@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Improved the error handling in the `HttpResponseInterceptor`
- Fixed an issue while using symbol profile overrides in the historical market data table of the admin control panel
- Added missing assets in _Storybook_ setup
## 2.139.1 - 2025-02-15

View File

@ -30,6 +30,7 @@ import {
EnhancedSymbolProfile,
Filter
} from '@ghostfolio/common/interfaces';
import { Sector } from '@ghostfolio/common/interfaces/sector.interface';
import { MarketDataPreset } from '@ghostfolio/common/types';
import { BadRequestException, Injectable, Logger } from '@nestjs/common';
@ -259,7 +260,8 @@ export class AdminService {
},
scraperConfiguration: true,
sectors: true,
symbol: true
symbol: true,
SymbolProfileOverrides: true
}
}),
this.prismaService.symbolProfile.count({ where })
@ -313,11 +315,10 @@ export class AdminService {
name,
Order,
sectors,
symbol
symbol,
SymbolProfileOverrides
}) => {
const countriesCount = countries
? Object.keys(countries).length
: 0;
let countriesCount = countries ? Object.keys(countries).length : 0;
const lastMarketPrice = lastMarketPriceMap.get(
getAssetProfileIdentifier({ dataSource, symbol })
@ -331,7 +332,34 @@ export class AdminService {
);
})?._count ?? 0;
const sectorsCount = sectors ? Object.keys(sectors).length : 0;
let sectorsCount = sectors ? Object.keys(sectors).length : 0;
if (SymbolProfileOverrides) {
assetClass = SymbolProfileOverrides.assetClass ?? assetClass;
assetSubClass =
SymbolProfileOverrides.assetSubClass ?? assetSubClass;
if (
(
SymbolProfileOverrides.countries as unknown as Prisma.JsonArray
)?.length > 0
) {
countriesCount = (
SymbolProfileOverrides.countries as unknown as Prisma.JsonArray
).length;
}
name = SymbolProfileOverrides.name ?? name;
if (
(SymbolProfileOverrides.sectors as unknown as Sector[])
?.length > 0
) {
sectorsCount = (
SymbolProfileOverrides.sectors as unknown as Prisma.JsonArray
).length;
}
}
return {
assetClass,

View File

@ -204,8 +204,7 @@ export class SymbolProfileService {
?.length > 0
) {
item.countries = this.getCountries(
item.SymbolProfileOverrides
?.countries as unknown as Prisma.JsonArray
item.SymbolProfileOverrides.countries as unknown as Prisma.JsonArray
);
}
@ -214,22 +213,22 @@ export class SymbolProfileService {
?.length > 0
) {
item.holdings = this.getHoldings(
item.SymbolProfileOverrides?.holdings as unknown as Prisma.JsonArray
item.SymbolProfileOverrides.holdings as unknown as Prisma.JsonArray
);
}
item.name = item.SymbolProfileOverrides?.name ?? item.name;
item.name = item.SymbolProfileOverrides.name ?? item.name;
if (
(item.SymbolProfileOverrides.sectors as unknown as Sector[])?.length >
0
) {
item.sectors = this.getSectors(
item.SymbolProfileOverrides?.sectors as unknown as Prisma.JsonArray
item.SymbolProfileOverrides.sectors as unknown as Prisma.JsonArray
);
}
item.url = item.SymbolProfileOverrides?.url ?? item.url;
item.url = item.SymbolProfileOverrides.url ?? item.url;
delete item.SymbolProfileOverrides;
}