Skip to content
Snippets Groups Projects
Commit 461f4508 authored by Jakob Moser's avatar Jakob Moser
Browse files

Implement from_dir

parent c73598fa
No related branches found
No related tags found
No related merge requests found
Pipeline #6636 passed
......@@ -13,7 +13,7 @@ from .loader import load_pdf
@dataclass(frozen=True, eq=False)
class PaymentOrderCollection(Iterable[PaymentOrder]):
base_dir: Path
orders: tuple[PaymentOrder, ...]
@classmethod
def get(cls, studienfachschaft: Studienfachschaft, year: int) -> Self:
......@@ -21,10 +21,14 @@ class PaymentOrderCollection(Iterable[PaymentOrder]):
@classmethod
def from_dir(cls, path_or_str: Path | str) -> Self:
pass # TODO
return cls(
tuple(
load_pdf(pdf) for pdf in Path(path_or_str).rglob("*.pdf")
)
)
def __iter__(self) -> Iterator[PaymentOrder]:
return (load_pdf(pdf) for pdf in self.base_dir.rglob("*.pdf"))
return iter(self.orders)
@property
def by_budgetary_item_id(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment