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:
parent
46878ea5a8
commit
69a0de28cd
@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Improved the error handling in the `HttpResponseInterceptor`
|
- 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
|
- Added missing assets in _Storybook_ setup
|
||||||
|
|
||||||
## 2.139.1 - 2025-02-15
|
## 2.139.1 - 2025-02-15
|
||||||
|
@ -30,6 +30,7 @@ import {
|
|||||||
EnhancedSymbolProfile,
|
EnhancedSymbolProfile,
|
||||||
Filter
|
Filter
|
||||||
} from '@ghostfolio/common/interfaces';
|
} from '@ghostfolio/common/interfaces';
|
||||||
|
import { Sector } from '@ghostfolio/common/interfaces/sector.interface';
|
||||||
import { MarketDataPreset } from '@ghostfolio/common/types';
|
import { MarketDataPreset } from '@ghostfolio/common/types';
|
||||||
|
|
||||||
import { BadRequestException, Injectable, Logger } from '@nestjs/common';
|
import { BadRequestException, Injectable, Logger } from '@nestjs/common';
|
||||||
@ -259,7 +260,8 @@ export class AdminService {
|
|||||||
},
|
},
|
||||||
scraperConfiguration: true,
|
scraperConfiguration: true,
|
||||||
sectors: true,
|
sectors: true,
|
||||||
symbol: true
|
symbol: true,
|
||||||
|
SymbolProfileOverrides: true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
this.prismaService.symbolProfile.count({ where })
|
this.prismaService.symbolProfile.count({ where })
|
||||||
@ -313,11 +315,10 @@ export class AdminService {
|
|||||||
name,
|
name,
|
||||||
Order,
|
Order,
|
||||||
sectors,
|
sectors,
|
||||||
symbol
|
symbol,
|
||||||
|
SymbolProfileOverrides
|
||||||
}) => {
|
}) => {
|
||||||
const countriesCount = countries
|
let countriesCount = countries ? Object.keys(countries).length : 0;
|
||||||
? Object.keys(countries).length
|
|
||||||
: 0;
|
|
||||||
|
|
||||||
const lastMarketPrice = lastMarketPriceMap.get(
|
const lastMarketPrice = lastMarketPriceMap.get(
|
||||||
getAssetProfileIdentifier({ dataSource, symbol })
|
getAssetProfileIdentifier({ dataSource, symbol })
|
||||||
@ -331,7 +332,34 @@ export class AdminService {
|
|||||||
);
|
);
|
||||||
})?._count ?? 0;
|
})?._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 {
|
return {
|
||||||
assetClass,
|
assetClass,
|
||||||
|
@ -204,8 +204,7 @@ export class SymbolProfileService {
|
|||||||
?.length > 0
|
?.length > 0
|
||||||
) {
|
) {
|
||||||
item.countries = this.getCountries(
|
item.countries = this.getCountries(
|
||||||
item.SymbolProfileOverrides
|
item.SymbolProfileOverrides.countries as unknown as Prisma.JsonArray
|
||||||
?.countries as unknown as Prisma.JsonArray
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,22 +213,22 @@ export class SymbolProfileService {
|
|||||||
?.length > 0
|
?.length > 0
|
||||||
) {
|
) {
|
||||||
item.holdings = this.getHoldings(
|
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 (
|
if (
|
||||||
(item.SymbolProfileOverrides.sectors as unknown as Sector[])?.length >
|
(item.SymbolProfileOverrides.sectors as unknown as Sector[])?.length >
|
||||||
0
|
0
|
||||||
) {
|
) {
|
||||||
item.sectors = this.getSectors(
|
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;
|
delete item.SymbolProfileOverrides;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user