Verified Commit c4d5a990 authored by Jakob Moser's avatar Jakob Moser
Browse files

Move formatter method

parent 2e81caf3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -10,3 +10,8 @@ def parse_euro_amount(amount_str: str) -> Decimal:
        return Decimal(amount_without_sign.replace(".", "").replace(",", "."))
    else:
        return Decimal(amount_without_sign.replace(",", ""))


def format_as_euro_de(amount: Decimal) -> str:
    # TODO Move this somewhere more fitting
    return f"{amount}".replace(".", ",")
+5 −7
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@ import json

from tabulate import tabulate

from ..amount.AmountParser import format_as_euro_de

from ..budget_plan.BudgetPlan import BudgetPlan
from ..payment_order.PaymentOrder import PaymentOrder

@@ -15,10 +17,6 @@ from ..budget_plan.BudgetPlanLoader import load_pdf
from ..payment_order.PaymentOrderCollection import PaymentOrderCollection


def _format_as_euro_de(amount: Decimal) -> str:
    return f"{amount}".replace(".", ",")


@dataclass(eq=False, frozen=True)
class CashFlowAnalysis:
    budget_plan: BudgetPlan
@@ -43,9 +41,9 @@ class CashFlowAnalysis:
            (
                id,
                name,
                _format_as_euro_de(spent),
                _format_as_euro_de(remaining),
                _format_as_euro_de(total),
                format_as_euro_de(spent),
                format_as_euro_de(remaining),
                format_as_euro_de(total),
            )
            for (id, name, spent, remaining, total) in output_rows
        ]