fix: budgets showing wrong value
Frontend CI / build (push) Successful in 1m58s
Backend CI / build-and-push (push) Successful in 6m4s

This commit is contained in:
2026-07-09 20:38:23 -03:00
parent a359bac0bd
commit 7acb2cb502
2 changed files with 5 additions and 1 deletions
@@ -48,6 +48,10 @@ public class BudgetResource {
User user = currentUser.require();
LocalDate start = LocalDate.parse(yearMonth + "-01");
LocalDate end = start.plusMonths(1).minusDays(1);
LocalDate today = LocalDate.now();
if (end.isAfter(today)) {
end = today;
}
return em.createQuery(
"SELECT new com.ledger.budget.CategorySpend(t.category.id, t.category.name, SUM(t.amount)) " +
+1 -1
View File
@@ -48,7 +48,7 @@ export default function Budgets() {
);
const totalBudgeted = budgets.reduce((s, b) => s + Number(b.limitAmount), 0);
const totalSpent = Object.values(spendByCategory).reduce((s, v) => s + v, 0);
const totalSpent = budgets.reduce((s, b) => s + (spendByCategory[b.category?.id] || 0), 0);
const [showForm, setShowForm] = useState(false);
const [categoryId, setCategoryId] = useState('');