Merge pull request #593 from bigcapitalhq/fix-round-pending-matching

fix: Rounding the total amount the pending and matched transactions
This commit is contained in:
Ahmed Bouhuolia
2024-08-12 13:01:27 +02:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

@@ -64,7 +64,7 @@ export class GetMatchedTransactions {
.whereIn('id', uncategorizedTransactionIds)
.throwIfNotFound();
const totalPending = Math.abs(sumBy(uncategorizedTransactions, 'amount'));
const totalPending = sumBy(uncategorizedTransactions, 'amount');
const filtered = filter.transactionType
? this.registered.filter((item) => item.type === filter.transactionType)

View File

@@ -1,8 +1,8 @@
import { useMemo } from 'react';
import { useFormikContext } from 'formik';
import { round } from 'lodash';
import { MatchingTransactionFormValues } from './types';
import { useMatchingTransactionBoot } from './MatchingTransactionBoot';
import { useCategorizeTransactionTabsBoot } from './CategorizeTransactionTabsBoot';
import { useMemo } from 'react';
export const transformToReq = (
values: MatchingTransactionFormValues,
@@ -38,7 +38,7 @@ export const useGetPendingAmountMatched = () => {
);
const pendingAmount = totalPending - totalMatchedAmount;
return pendingAmount;
return round(pendingAmount, 2);
}, [totalPending, perfectMatches, possibleMatches, values]);
};