Fixed bugs 2 #15
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user