From 6db77347eee1863fa602c6d206ac0ee70dd1b5a1 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 20 Mar 2025 03:43:01 +0100 Subject: [PATCH] Fix balance showing not-yet-used accounts. --- src/templates/balance.tmpl | 66 ++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/src/templates/balance.tmpl b/src/templates/balance.tmpl index cfd46f7..35f0fae 100644 --- a/src/templates/balance.tmpl +++ b/src/templates/balance.tmpl @@ -2,41 +2,43 @@ {% macro account_with_children(booking_id, account, indent) %} - - - {% if account.get_wealth(booking_id).moneys|length == 1 %} - - {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} - {{ macros.tr_money_balance(amt, curr) }} - {% endfor %} -
- {% else %} -
- - - {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} - {% if 1 == loop.index %} - {{ macros.tr_money_balance(amt, curr) }} - {% endif %} - {% endfor %} -
-
- - {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} - {% if 1 < loop.index %} + {% if account.get_wealth(booking_id).moneys|length > 0 %} + + + + + + {% for child in account.children %} + {{ account_with_children(booking_id, child, indent=indent+1) }} {% endfor %} -
+ {% if account.get_wealth(booking_id).moneys|length == 1 %} + + {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} {{ macros.tr_money_balance(amt, curr) }} - {% endif %} + {% endfor %} +
+ {% else %} +
+ + + {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} + {% if 1 == loop.index %} + {{ macros.tr_money_balance(amt, curr) }} + {% endif %} + {% endfor %} +
+
+ + {% for curr, amt in account.get_wealth(booking_id).moneys.items() %} + {% if 1 < loop.index %} + {{ macros.tr_money_balance(amt, curr) }} + {% endif %} + {% endfor %} +
+
+ {% endif %} +
{% for i in range(indent) %} {% endfor %}{% if account.parent %}:{% endif %}{{account.basename}}{% if account.children %}:{% endif %}{{account.desc}}
-
{% endif %} - - {% for i in range(indent) %} {% endfor %}{% if account.parent %}:{% endif %}{{account.basename}}{% if account.children %}:{% endif %} - {{account.desc}} - - {% for child in account.children %} - {{ account_with_children(booking_id, child, indent=indent+1) }} - {% endfor %} {% endmacro %} -- 2.30.2