From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 9 Feb 2025 08:23:19 +0000 (+0100)
Subject: Restore alphabetical sorting of account names.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/booking/%7B%7Bprefix%7D%7D/all?a=commitdiff_plain;h=d405dfb211fa776220cccfc0585c0d0591980fb9;p=ledgplom

Restore alphabetical sorting of account names.
---

diff --git a/src/run.py b/src/run.py
index b3e2c5c..abd1709 100755
--- a/src/run.py
+++ b/src/run.py
@@ -487,7 +487,7 @@ class Handler(PlomHttpHandler):
         ctx['valid'] = 0 == len([b for b in to_balance if b.is_questionable])
         ctx['roots'] = observed_tree
         if not raw:
-            ctx['all_accounts'] = accounts_after.keys()
+            ctx['all_accounts'] = sorted(accounts_after.keys())
         self._send_rendered(EDIT_RAW if raw else EDIT_STRUCT, ctx)
 
     def get_ledger(self, ctx: dict[str, Any], raw: bool) -> None:
@@ -571,7 +571,7 @@ class Server(PlomHttpServer):
             for account_name in booking.account_changes:
                 booked_names.add(account_name)
         paths_to_accs: dict[str, Account] = {}
-        for full_name in booked_names:
+        for full_name in sorted(list(booked_names)):
             path = ''
             for step_name in full_name.split(':'):
                 parent_name = path[:]