diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 5743d90dbf80e..86df5ee0a4706 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -109,7 +109,7 @@ function SearchPage({route}: SearchPageProps) { const shouldUseClientTotal = selectedTransactionsKeys.length > 0 || !metadata?.count || (selectedTransactionsKeys.length > 0 && !areAllMatchingItemsSelected); const selectedTransactionItems = Object.values(selectedTransactions); - const currency = metadata?.currency ?? selectedTransactionItems.at(0)?.groupCurrency; + const currency = metadata?.currency ?? selectedTransactionItems.at(0)?.groupCurrency ?? selectedTransactionItems.at(0)?.currency; const numberOfExpense = shouldUseClientTotal ? selectedTransactionsKeys.reduce((count, key) => { const item = selectedTransactions[key]; @@ -119,7 +119,7 @@ function SearchPage({route}: SearchPageProps) { return count + 1; }, 0) : metadata?.count; - const total = shouldUseClientTotal ? selectedTransactionItems.reduce((acc, transaction) => acc - (transaction.groupAmount ?? 0), 0) : metadata?.total; + const total = shouldUseClientTotal ? selectedTransactionItems.reduce((acc, transaction) => acc - (transaction.groupAmount ?? -Math.abs(transaction.amount)), 0) : metadata?.total; return {count: numberOfExpense, total, currency}; }, [areAllMatchingItemsSelected, metadata?.count, metadata?.currency, metadata?.total, selectedTransactions, selectedTransactionsKeys, shouldAllowFooterTotals]);