MEJORA: Fix N+1 query problems in project_list and export_expenses_csv

This commit is contained in:
Nachou-u
2026-09-09 08:26:36 -03:00
parent 1417cff823
commit c229da1436
2 changed files with 8 additions and 3 deletions
+2
View File
@@ -83,6 +83,8 @@ class Project(CatalogModel):
@property
def total_expenses_clp(self):
if hasattr(self, 'total_expenses'):
return self.total_expenses or Decimal('0.00')
return self.expenses.aggregate(total=models.Sum('amount_clp'))['total'] or Decimal('0.00')
@property