chart data source supports expense and income by primary category

This commit is contained in:
MaysWind
2021-01-26 22:59:13 +08:00
parent fb155aae47
commit dd70247e08
3 changed files with 138 additions and 56 deletions
+11 -1
View File
@@ -771,8 +771,18 @@ const stores = {
item.category = state.allTransactionCategoriesMap[item.categoryId];
}
if (item.category && item.category.parentId !== '0') {
item.primaryCategory = state.allTransactionCategoriesMap[item.category.parentId];
} else {
item.primaryCategory = item.category;
}
if (item.account && item.account.currency !== defaultCurrency) {
item.amountInDefaultCurrency = getExchangedAmount(state)(item.amount, item.account.currency, defaultCurrency);
const amount = getExchangedAmount(state)(item.amount, item.account.currency, defaultCurrency);
if (utils.isNumber(amount)) {
item.amountInDefaultCurrency = Math.floor(amount);
}
} else if (item.account && item.account.currency === defaultCurrency) {
item.amountInDefaultCurrency = item.amount;
} else {