Fixed bugs 2 #15

Merged
jkuijperm merged 13 commits from dev into main 2026-07-24 09:38:43 +00:00
Showing only changes of commit 8d1f477940 - Show all commits

View File

@ -1,3 +1,4 @@
import logging
from operator import truediv
from datetime import date, datetime
from django.contrib import messages
@ -39,6 +40,7 @@ MONTHS = {
12: "DICIEMBRE",
}
logger = logging.getLogger(__name__)
def _get_int(value):
try:
@ -127,8 +129,11 @@ def expense_list(request):
category = _get_int(request.GET.get("category"))
account_id = _get_int(request.GET.get("account"))
tag_ids = request.GET.getlist("tag")
tag_ids = [int(t) for t in tag_ids]
tag_ids = [
t_id
for t in request.GET.getlist("tag")
if (t_id:= _get_int(t)) is not None
]
if year:
expenses = expenses.filter(date__year=year)
@ -449,7 +454,11 @@ def dashboard(request):
try:
monthly_data = acc.monthly_balance(selected_year)
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
if selected_year == today.year: