From: Christian Heller Date: Wed, 22 Jan 2025 11:22:06 +0000 (+0100) Subject: Warn for _all_ lines of Booking with invalid lines. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%22https:/validator.w3.org/%7B%7Bprefix%7D%7D?a=commitdiff_plain;h=38a220cacbc54a30c942a2fe9560da76809d7010;p=plomledger Warn for _all_ lines of Booking with invalid lines. --- diff --git a/ledger.py b/ledger.py index f82cc41..2a13d4b 100755 --- a/ledger.py +++ b/ledger.py @@ -57,6 +57,7 @@ class DatLine: self.comment = halves[1] if len(halves) > 1 else '' self.code = halves[0] self.booking_line: Optional[BookingLine] = None + self.questionable = False @property def is_intro(self) -> bool: @@ -156,8 +157,6 @@ class Booking: dat_line.booking_line = TransferLine(self.id_, dat_line.code) self.account_changes: dict[str, Wealth] = {} self.sink_account = None - for dat_line in [dl for dl in self.dat_lines if dl.error]: - return changes = Wealth() for transfer_line in [dl.booking_line for dl in self.dat_lines[1:]]: assert isinstance(transfer_line, TransferLine) @@ -175,9 +174,11 @@ class Booking: if self.sink_account: self.account_changes[self.sink_account] += changes.as_sink elif not changes.sink_empty: - last_line = self.dat_lines[-1] - assert isinstance(last_line.booking_line, BookingLine) - last_line.booking_line.error = 'needed sink missing' + assert self.dat_lines[-1].booking_line is not None + self.dat_lines[-1].booking_line.error = 'needed sink missing' + for dat_line in [dl for dl in self.dat_lines if dl.error]: + for dl in self.dat_lines: + dl.questionable = True class Handler(PlomHttpHandler): diff --git a/templates/_base.tmpl b/templates/_base.tmpl index 2206d51..217af12 100644 --- a/templates/_base.tmpl +++ b/templates/_base.tmpl @@ -6,7 +6,6 @@ diff --git a/templates/_macros.tmpl b/templates/_macros.tmpl index b3cb64a..2989bd6 100644 --- a/templates/_macros.tmpl +++ b/templates/_macros.tmpl @@ -1,4 +1,6 @@ {% macro css_value_line() %} +tr.warning td { background-color: #ff8888; } +td.invalid, tr.warning td.invalid { background-color: #ff0000; } td.amt { text-align: right } td.amt, td.curr { font-family: monospace; font-size: 1.3em; } td.curr { text-align: center; } @@ -10,7 +12,7 @@ td.curr { text-align: center; } {% if (not (raw or single)) and dat_line.is_intro and loop.index > 1 %}   {% endif %} - + {% if not single %} {% if dat_line.is_intro %} # @@ -38,7 +40,7 @@ td.curr { text-align: center; } {% endif %} {% if dat_line.error and not raw %} - {{dat_line.error}} + {% if not single %}{% endif %}{{dat_line.error}} {% endif %} {% endfor %}