diff --git a/app/apps/insights/views.py b/app/apps/insights/views.py index bd65640..a5698a5 100644 --- a/app/apps/insights/views.py +++ b/app/apps/insights/views.py @@ -177,11 +177,14 @@ def category_overview(request): if "show_tags" in request.GET: show_tags = request.GET["show_tags"] == "on" request.session["insights_category_explorer_show_tags"] = show_tags - print(request.GET["show_tags"], show_tags) else: show_tags = request.session.get("insights_category_explorer_show_tags", True) - print(show_tags) + if "showing" in request.GET: + showing = request.GET["showing"] + request.session["insights_category_explorer_showing"] = showing + else: + showing = request.session.get("insights_category_explorer_showing", "final") # Get filtered transactions transactions = get_transactions(request, include_silent=True) @@ -193,7 +196,12 @@ def category_overview(request): return render( request, "insights/fragments/category_overview/index.html", - {"total_table": total_table, "view_type": view_type, "show_tags": show_tags}, + { + "total_table": total_table, + "view_type": view_type, + "show_tags": show_tags, + "showing": showing, + }, ) diff --git a/app/templates/insights/fragments/category_overview/index.html b/app/templates/insights/fragments/category_overview/index.html index 6825a34..c29dd60 100644 --- a/app/templates/insights/fragments/category_overview/index.html +++ b/app/templates/insights/fragments/category_overview/index.html @@ -1,15 +1,14 @@ {% load i18n %}
| {% if category.name %}{{ category.name }}{% else %}{% trans 'Uncategorized' %}{% endif %} | -+ | {# income #}
{% for currency in category.currencies.values %}
- {% if currency.total_income != 0 %}
+ {% if showing == 'current' and currency.income_current != 0 %}
+ |
+ | {# expenses #}
{% for currency in category.currencies.values %}
- {% if currency.total_expense != 0 %}
+ {% if showing == 'current' and currency.expense_current != 0 %}
+ |
+ | {# total #}
{% for currency in category.currencies.values %}
- {% if currency.total_final != 0 %}
+ {% if showing == 'current' and currency.total_current != 0 %}
+ |
{% for currency in tag.currencies.values %}
- {% if currency.total_income != 0 %}
+ {% if showing == 'current' and currency.income_current != 0 %}
+ |
{% for currency in tag.currencies.values %}
- {% if currency.total_expense != 0 %}
+ {% if showing == 'current' and currency.expense_current != 0 %}
+ |
{% for currency in tag.currencies.values %}
- {% if currency.total_final != 0 %}
+ {% if showing == 'current' and currency.total_current != 0 %}
+ |
+
{{ total_table|json_script:"categoryOverviewData" }}
+ {{ showing|json_script:"showingString" }}
|
|---|