From fdf65ec16872859851f640ca8c9a30d395ea4a39 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 13 Feb 2025 03:19:18 +0100
Subject: [PATCH] In booking balance, also show accounts of zero diff _if_
 they've been directly set in the Booking.

---
 src/run.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/run.py b/src/run.py
index 17cc63b..bafb5bb 100755
--- a/src/run.py
+++ b/src/run.py
@@ -469,10 +469,14 @@ class Handler(PlomHttpHandler):
                     continue
                 wealth_before = accounts_before[path].wealth
                 wealth_after = accounts_after[path].wealth
-                diff = {c: a for c, a in (wealth_after - wealth_before
-                                          ).moneys.items()
-                        if a != 0}
-                if diff:
+                directly_set = full_name == path
+                diff = {
+                    c: a for c, a in (wealth_after - wealth_before
+                                      ).moneys.items()
+                    if a != 0
+                    or (directly_set
+                        and c in booking.account_changes[full_name].moneys)}
+                if diff or directly_set:
                     displayed_currencies = set(diff.keys())
                     for wealth in wealth_before, wealth_after:
                         wealth.ensure_currencies(displayed_currencies)
-- 
2.30.2