From 5af83dca4a0d259be8cfcfbf496b0892922d47ed Mon Sep 17 00:00:00 2001 From: csehatt741 Date: Mon, 14 Apr 2025 14:45:34 +0200 Subject: [PATCH] Missing exchange rates gathered --- apps/api/src/app/import/import.service.ts | 43 +++++++++++++++++++---- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index e4ce3ba96..a68c7887c 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -419,14 +419,43 @@ export class ImportService { }); }); + const dataGatheringItems = uniqueActivities.flatMap( + ({ currency, date, SymbolProfile }) => { + const activityDataGatheringItems = [ + { + date, + dataSource: SymbolProfile.dataSource, + symbol: SymbolProfile.symbol + } + ]; + + if (currency !== SymbolProfile.currency) { + activityDataGatheringItems.push({ + date, + dataSource: + this.dataProviderService.getDataSourceForExchangeRates(), + symbol: `${currency}${SymbolProfile.currency}` + }); + } + + if ( + (currency ?? SymbolProfile.currency) !== + user.Settings.settings.baseCurrency + ) { + activityDataGatheringItems.push({ + date, + dataSource: + this.dataProviderService.getDataSourceForExchangeRates(), + symbol: `${currency ?? SymbolProfile.currency}${user.Settings.settings.baseCurrency}` + }); + } + + return activityDataGatheringItems; + } + ); + this.dataGatheringService.gatherSymbols({ - dataGatheringItems: uniqueActivities.map(({ date, SymbolProfile }) => { - return { - date, - dataSource: SymbolProfile.dataSource, - symbol: SymbolProfile.symbol - }; - }), + dataGatheringItems, priority: DATA_GATHERING_QUEUE_PRIORITY_HIGH }); }