From 4cff481d615a23cfe2b7e92af83eaefffda3087b Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 31 Jul 2023 01:36:32 +0800 Subject: [PATCH] fix the problem that the monthly total income/expense amount sometimes is wrong --- src/stores/transaction.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/stores/transaction.js b/src/stores/transaction.js index 9b5f337d..1f714632 100644 --- a/src/stores/transaction.js +++ b/src/stores/transaction.js @@ -198,14 +198,14 @@ function calculateMonthTotalAmount(state, exchangeRatesStore, transactionMonthLi continue; } - amount = Math.floor(balance); + amount = balance; } if (transaction.type === transactionConstants.allTransactionTypes.Expense) { totalExpense += amount; } else if (transaction.type === transactionConstants.allTransactionTypes.Income) { totalIncome += amount; - } else if (transaction.type === transactionConstants.allTransactionTypes.Transfer && accountId) { + } else if (transaction.type === transactionConstants.allTransactionTypes.Transfer && accountId && accountId !== '0') { if (accountId === transaction.sourceAccountId) { totalExpense += amount; } else if (accountId === transaction.destinationAccountId) { @@ -222,9 +222,9 @@ function calculateMonthTotalAmount(state, exchangeRatesStore, transactionMonthLi } transactionMonthList.totalAmount = { - expense: totalExpense, + expense: Math.floor(totalExpense), incompleteExpense: incomplete || hasUnCalculatedTotalExpense, - income: totalIncome, + income: Math.floor(totalIncome), incompleteIncome: incomplete || hasUnCalculatedTotalIncome }; }