From 608da4be5560f426b744fe1ad5840b657beae5d7 Mon Sep 17 00:00:00 2001
From: "Edgar P. Burkhart" <git@edgarpierre.fr>
Date: Sun, 5 Jan 2025 15:15:35 +0100
Subject: [PATCH] Refactor category_plot tag to remove budget parameter Fix #45

---
 nummi/category/templatetags/category.py                   | 4 ++--
 nummi/statement/templates/statement/statement_detail.html | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/nummi/category/templatetags/category.py b/nummi/category/templatetags/category.py
index de35972..e7d2396 100644
--- a/nummi/category/templatetags/category.py
+++ b/nummi/category/templatetags/category.py
@@ -6,10 +6,10 @@ register = template.Library()
 
 
 @register.inclusion_tag("category/category_plot.html", takes_context=True)
-def category_plot(context, transactions, budget=True, **kwargs):
+def category_plot(context, transactions, **kwargs):
     kwargs.setdefault("account", context.get("account"))
 
-    if budget:
+    if not kwargs.get("account"):
         transactions = transactions.exclude(category__budget=False)
     categories = (
         transactions.values("category", "category__name", "category__icon")
diff --git a/nummi/statement/templates/statement/statement_detail.html b/nummi/statement/templates/statement/statement_detail.html
index fa963e1..c62343c 100644
--- a/nummi/statement/templates/statement/statement_detail.html
+++ b/nummi/statement/templates/statement/statement_detail.html
@@ -65,6 +65,6 @@
   </section>
   <section>
     <h3>{% translate "Categories" %}</h3>
-    {% category_plot transactions budget=False statement=object %}
+    {% category_plot transactions statement=object %}
   </section>
 {% endblock body %}