try to do better

This commit is contained in:
arrelin
2026-03-06 15:09:49 +03:00
parent 50f5610459
commit 5b4ff98cc5
2 changed files with 3 additions and 2 deletions

View File

@@ -150,11 +150,12 @@ impl ExpenseService {
let mut result: Vec<MonthlyExpenseGroup> = grouped
.into_iter()
.map(|((year, month), expenses)| {
.map(|((year, month), mut expenses)| {
let total_amount: Decimal = expenses
.iter()
.map(|e| e.amount)
.sum();
expenses.sort_by(|a, b| b.created_at.cmp(&a.created_at));
MonthlyExpenseGroup {
year,
month,