From 1a4109ebaa1d1ea08b93d993a268f359d469eb00 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 16 Jan 2022 13:46:00 +0100 Subject: [PATCH] Bugfix/fix fallback to load currencies directly from data provider (#629) * Fix fallback * Update changelog --- CHANGELOG.md | 6 ++++++ apps/api/src/services/exchange-rate-data.service.ts | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10b0c4d2e..387ebb8ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Fixed the fallback to load currencies directly from the data provider + ## 1.103.0 - 13.01.2022 ### Changed diff --git a/apps/api/src/services/exchange-rate-data.service.ts b/apps/api/src/services/exchange-rate-data.service.ts index e83516e27..f77f7ef79 100644 --- a/apps/api/src/services/exchange-rate-data.service.ts +++ b/apps/api/src/services/exchange-rate-data.service.ts @@ -58,9 +58,9 @@ export class ExchangeRateDataService { getYesterday() ); - if (isEmpty(result)) { + if (Object.keys(result).length !== this.currencyPairs.length) { // Load currencies directly from data provider as a fallback - // if historical data is not yet available + // if historical data is not fully available const historicalData = await this.dataProviderService.get( this.currencyPairs.map(({ dataSource, symbol }) => { return { dataSource, symbol };