fix the problem that the monthly total income/expense amount sometimes is wrong

This commit is contained in:
MaysWind
2023-07-31 01:36:32 +08:00
parent 6da910d8fb
commit 4cff481d61
+4 -4
View File
@@ -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
};
}