fix the problem that the monthly total income/expense amount sometimes is wrong
This commit is contained in:
@@ -198,14 +198,14 @@ function calculateMonthTotalAmount(state, exchangeRatesStore, transactionMonthLi
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
amount = Math.floor(balance);
|
amount = balance;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transaction.type === transactionConstants.allTransactionTypes.Expense) {
|
if (transaction.type === transactionConstants.allTransactionTypes.Expense) {
|
||||||
totalExpense += amount;
|
totalExpense += amount;
|
||||||
} else if (transaction.type === transactionConstants.allTransactionTypes.Income) {
|
} else if (transaction.type === transactionConstants.allTransactionTypes.Income) {
|
||||||
totalIncome += amount;
|
totalIncome += amount;
|
||||||
} else if (transaction.type === transactionConstants.allTransactionTypes.Transfer && accountId) {
|
} else if (transaction.type === transactionConstants.allTransactionTypes.Transfer && accountId && accountId !== '0') {
|
||||||
if (accountId === transaction.sourceAccountId) {
|
if (accountId === transaction.sourceAccountId) {
|
||||||
totalExpense += amount;
|
totalExpense += amount;
|
||||||
} else if (accountId === transaction.destinationAccountId) {
|
} else if (accountId === transaction.destinationAccountId) {
|
||||||
@@ -222,9 +222,9 @@ function calculateMonthTotalAmount(state, exchangeRatesStore, transactionMonthLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
transactionMonthList.totalAmount = {
|
transactionMonthList.totalAmount = {
|
||||||
expense: totalExpense,
|
expense: Math.floor(totalExpense),
|
||||||
incompleteExpense: incomplete || hasUnCalculatedTotalExpense,
|
incompleteExpense: incomplete || hasUnCalculatedTotalExpense,
|
||||||
income: totalIncome,
|
income: Math.floor(totalIncome),
|
||||||
incompleteIncome: incomplete || hasUnCalculatedTotalIncome
|
incompleteIncome: incomplete || hasUnCalculatedTotalIncome
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user