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

Implement total_income

parent a75826d6
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
from pathlib import Path
from itertools import chain
from dataclasses import dataclass
from typing import Self
from decimal import Decimal
@@ -57,7 +58,16 @@ class CashFlowAnalysis:

    @property
    def total_income(self) -> Decimal:
        pass
        # Assignments (Zuweisungen) and reserves (Rücklagen) is the only kind of income we automatically get
        assignments = self.budget_plan.group("1")
        reserves = self.budget_plan.group("3")

        return sum(
            item.amount for item in chain(
                assignments.items if assignments else [],
                reserves.items if reserves else []
            )
        )

    @property
    def total_expenses(self) -> Decimal: