From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 20 Jan 2025 10:54:09 +0000 (+0100)
Subject: For Booking view, use '/{Booking.id_}' rather than '?idx={Booking.id_}'.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/add_task?a=commitdiff_plain;h=586b58498d1c4d2998dddea34492c110f99455ae;p=ledgplom

For Booking view, use '/{Booking.id_}' rather than '?idx={Booking.id_}'.
---

diff --git a/ledger.py b/ledger.py
index 746d8a3..eee9c5d 100755
--- a/ledger.py
+++ b/ledger.py
@@ -76,7 +76,7 @@ class Handler(PlomHttpHandler):
     def do_GET(self) -> None:
         # pylint: disable=invalid-name,missing-function-docstring
         if self.pagename == 'booking':
-            b = self.server.bookings[int(self.params.first('idx'))]
+            b = self.server.bookings[int(self.path_toks[2])]
             dat_lines = self.server.dat_lines[b.idx_start:b.idx_end]
             self.send_rendered(Path('index.tmpl'), {'dat_lines': dat_lines})
         elif self.pagename == 'raw':
diff --git a/templates/index.tmpl b/templates/index.tmpl
index ca1e096..bf83499 100644
--- a/templates/index.tmpl
+++ b/templates/index.tmpl
@@ -22,7 +22,7 @@ td.curr { text-align: center; }
   {% if l.type == "value" %}
     <td class="amt">{{l.amt}}</td><td class="curr">{{l.curr|truncate(4,true,"…")}}</td><td>{{l.acc}}</td>
   {% elif l.type == "intro" %}
-    <td class="code" colspan=3><a href="booking?idx={{l.booking.id_}}">{{l.code}}</a></td>
+    <td class="code" colspan=3><a href="/booking/{{l.booking.id_}}">{{l.code}}</a></td>
   {% else %}
     <td colspan=3>{{l.code}}</td>
   {% endif %}