home · contact · privacy
Fix bug of disappearing last booking.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 14 Apr 2025 04:22:02 +0000 (06:22 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 14 Apr 2025 04:22:02 +0000 (06:22 +0200)
src/ledgplom/ledger.py

index 669a8ba6dc800b41f6ccb24371f38a61b29e72d3..f7f70e786db1e6bae78dba4c1e11a571c8417839 100644 (file)
@@ -543,6 +543,8 @@ class Ledger:
         dat_lines: list[_DatLine] = [
             _DatLine.from_raw(line)
             for line in self._path_dat.read_text(encoding='utf8').splitlines()]
+        if (not dat_lines) or dat_lines[-1].code:  # ensure final gap line so
+            dat_lines += [_DatLine()]              # last booking gets finished
         booking_lines: list[_BookingLine] = []
         new_block = DatBlock(None, _Gap())
         self._blocks_start = new_block