From 23f7a9fae6b2ba9c9a87b5865c754920f7274480 Mon Sep 17 00:00:00 2001 From: Azizjon Nurov Date: Tue, 24 Dec 2024 17:14:41 +0500 Subject: [PATCH] Exclude failed exchange rates --- lib/utils/invoiceExport/getInvoiceExportData.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils/invoiceExport/getInvoiceExportData.js b/lib/utils/invoiceExport/getInvoiceExportData.js index 1cb4e724..bbeeff3f 100644 --- a/lib/utils/invoiceExport/getInvoiceExportData.js +++ b/lib/utils/invoiceExport/getInvoiceExportData.js @@ -81,9 +81,10 @@ export const getInvoiceExportData = async ({ ky, intl, query, currency: to }) => }); const addresses = getAddresses(addressRecords); const currencies = uniq(exportInvoices.map(({ currency }) => currency)); - const exchangeRates = await Promise.all( + const allExchangeRates = await Promise.allSettled( currencies.map(from => ky.get(EXCHANGE_RATE_API, { searchParams: { from, to } }).json()), ); + const exchangeRates = allExchangeRates.filter(({ status }) => status === 'fulfilled'); return (createInvoiceExportReport({ acqUnitMap: keyBy(acqUnits, 'id'),