This commit is contained in:
JKuijperM 2026-07-22 15:22:36 +02:00
parent 5499607cd4
commit 8d1f477940

View File

@ -1,3 +1,4 @@
import logging
from operator import truediv from operator import truediv
from datetime import date, datetime from datetime import date, datetime
from django.contrib import messages from django.contrib import messages
@ -39,6 +40,7 @@ MONTHS = {
12: "DICIEMBRE", 12: "DICIEMBRE",
} }
logger = logging.getLogger(__name__)
def _get_int(value): def _get_int(value):
try: try:
@ -127,8 +129,11 @@ def expense_list(request):
category = _get_int(request.GET.get("category")) category = _get_int(request.GET.get("category"))
account_id = _get_int(request.GET.get("account")) account_id = _get_int(request.GET.get("account"))
tag_ids = request.GET.getlist("tag") tag_ids = [
tag_ids = [int(t) for t in tag_ids] t_id
for t in request.GET.getlist("tag")
if (t_id:= _get_int(t)) is not None
]
if year: if year:
expenses = expenses.filter(date__year=year) expenses = expenses.filter(date__year=year)
@ -449,7 +454,11 @@ def dashboard(request):
try: try:
monthly_data = acc.monthly_balance(selected_year) monthly_data = acc.monthly_balance(selected_year)
m_balance = [float(row["balance"]) for row in monthly_data] m_balance = [float(row["balance"]) for row in monthly_data]
except: except Exception:
logger.exception(
"Error calculando monthly_balance para la cuenta %s (año %s)",
acc.id, selected_year
)
m_balance = [0] * 12 m_balance = [0] * 12
if selected_year == today.year: if selected_year == today.year: