Verified Commit 01acdef5 authored by Jakob Moser's avatar Jakob Moser
Browse files

Use format_balance when creating rows

parent ce36557e
Loading
Loading
Loading
Loading
+2 −4
Changes for poolpay/admin/PersonsTable.py: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ from textual.reactive import reactive
from textual.widgets import DataTable
from textual.widgets.data_table import ColumnKey

from poolpay.admin.money import format_balance
from poolpay.model.Person import Person


@@ -22,13 +23,10 @@ def to_chunked_hex(i: int) -> str:


def to_row(p: Person) -> tuple[str, str, Text, str]:
    balance = format_currency(p.balance_cents / 100, "EUR", locale="de_DE")
    style = "green" if p.balance_cents > 0 else "red" if p.balance_cents < 0 else ""

    return (
        p.name,
        p.cl_account_name,
        Text(balance, style=style),
        format_balance(p.balance_cents),
        ", ".join(to_chunked_hex(card.id) for card in p.cards),
    )