Skip to content

Commit

Permalink
fix: rounding the total amount the pending and matched transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
abouolia committed Aug 12, 2024
1 parent 0a78d56 commit c928940
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -38,7 +38,7 @@ export const useGetPendingAmountMatched = () => {
);
const pendingAmount = totalPending - totalMatchedAmount;

return pendingAmount;
return round(pendingAmount, 2);
}, [totalPending, perfectMatches, possibleMatches, values]);
};

Expand Down

0 comments on commit c928940

Please sign in to comment.