Verified Commit 16cca6c0 authored by Jakob Moser's avatar Jakob Moser
Browse files

Making decimal parsing (and therefore sorting) work

It didn't work because we tried to remove the suffix " €" before parsing, but actually, the space was a special character
parent ba6c26c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ class PersonsTable(DataTable):
    def on_data_table_header_selected(self, event: DataTable.HeaderSelected) -> None:
        def convert_to_decimal_if_numeric(thing: str | Text) -> str | Decimal:
            str_value = thing.plain if isinstance(thing, Text) else thing
            str_value_no_currency_symbol = str_value.removesuffix("")
            str_value_no_currency_symbol = re.sub(r"\s*€$", "", str_value)

            try:
                return parse_decimal(str_value_no_currency_symbol)