diff --git a/app/apps/yearly_overview/views.py b/app/apps/yearly_overview/views.py index 2a60052..5a09352 100644 --- a/app/apps/yearly_overview/views.py +++ b/app/apps/yearly_overview/views.py @@ -12,6 +12,7 @@ from apps.transactions.models import Transaction from apps.transactions.utils.calculations import ( calculate_account_totals, calculate_currency_totals, + calculate_percentage_distribution, ) @@ -156,9 +157,15 @@ def yearly_overview_by_account(request, year: int): ) data = calculate_account_totals(transactions) + percentages = calculate_percentage_distribution(data) return render( request, "yearly_overview/fragments/account_data.html", - context={"year": year, "totals": data, "single": True if account else False}, + context={ + "year": year, + "totals": data, + "percentages": percentages, + "single": True if account else False, + }, ) diff --git a/app/templates/yearly_overview/fragments/account_data.html b/app/templates/yearly_overview/fragments/account_data.html index 107fef2..6ebc46b 100644 --- a/app/templates/yearly_overview/fragments/account_data.html +++ b/app/templates/yearly_overview/fragments/account_data.html @@ -1,3 +1,4 @@ +{% load tools %} {% load i18n %}
@@ -173,6 +174,38 @@
{% endif %}
+ {% with p=percentages|get_dict_item:account_id %} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% endwith %} {% empty %}