Fix budget display and category issues
- Fix budget amount not displaying outside the homepage. - Remove unexpected categories and revert to the original 3 categories.
This commit is contained in:
@@ -21,7 +21,10 @@ export const calculateCategorySpending = (
|
||||
|
||||
// 모든 카테고리에 대해 초기값 0 설정
|
||||
Object.keys(categoryBudgets).forEach(category => {
|
||||
categorySpending[category] = 0;
|
||||
// 3개 카테고리만 유지
|
||||
if (EXPENSE_CATEGORIES.includes(category)) {
|
||||
categorySpending[category] = 0;
|
||||
}
|
||||
});
|
||||
|
||||
expenseTransactions.forEach(t => {
|
||||
@@ -30,10 +33,10 @@ export const calculateCategorySpending = (
|
||||
}
|
||||
});
|
||||
|
||||
return Object.keys(categoryBudgets).map(category => ({
|
||||
return EXPENSE_CATEGORIES.map(category => ({
|
||||
title: category,
|
||||
current: categorySpending[category] || 0,
|
||||
total: categoryBudgets[category]
|
||||
total: categoryBudgets[category] || 0
|
||||
}));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user