Skip to content

Commit

Permalink
Exclude failed exchange rates
Browse files Browse the repository at this point in the history
  • Loading branch information
azizjonnurov committed Dec 24, 2024
1 parent ebd6659 commit 23f7a9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/utils/invoiceExport/getInvoiceExportData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit 23f7a9f

Please sign in to comment.