From 0f8bc7db328763509ce1e3cff1d05042ea32af00 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 8 Sep 2023 15:07:17 +0200 Subject: [PATCH] Bugfix/do not remove countries and sectors in yahoo finance data enhancer (#2297) * Do not remove countries and sectors * Update changelog --- CHANGELOG.md | 4 ++++ .../data-enhancer/yahoo-finance/yahoo-finance.service.ts | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f1ee105..b491138ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refreshed the cryptocurrencies list - Changed the version in the `docker-compose` files from `3.7` to `3.9` +### Fixed + +- Fixed an issue in the _Yahoo Finance_ data enhancer where countries and sectors have been removed + ## 1.305.0 - 2023-09-03 ### Added diff --git a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts index 9e7032de6..725d85457 100644 --- a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts +++ b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts @@ -8,6 +8,7 @@ import { AssetClass, AssetSubClass, DataSource, + Prisma, SymbolProfile } from '@prisma/client'; import { countries } from 'countries-list'; @@ -102,11 +103,11 @@ export class YahooFinanceDataEnhancerService implements DataEnhancerInterface { const { countries, sectors, url } = await this.getAssetProfile(yahooSymbol); - if (countries) { + if ((countries as unknown as Prisma.JsonArray)?.length > 0) { response.countries = countries; } - if (sectors) { + if ((sectors as unknown as Prisma.JsonArray)?.length > 0) { response.sectors = sectors; }