Loading muffin/budget_plan/BudgetPlan.py +11 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,17 @@ class BudgetPlan: return [item for group in self.groups for item in group.items] def item(self, id: str) -> BudgetaryItem: pass # TODO matching_items = [item for item in self.items if item.id == id] match len(matching_items): case 0: raise KeyError(f"No budgetary item with id = {id}") case 1: return matching_items[0] case _: raise RuntimeError( f"There were more than 1 budgetary item with the same id, this should not happen" ) @property def as_dict(self) -> dict[str, Any]: Loading Loading
muffin/budget_plan/BudgetPlan.py +11 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,17 @@ class BudgetPlan: return [item for group in self.groups for item in group.items] def item(self, id: str) -> BudgetaryItem: pass # TODO matching_items = [item for item in self.items if item.id == id] match len(matching_items): case 0: raise KeyError(f"No budgetary item with id = {id}") case 1: return matching_items[0] case _: raise RuntimeError( f"There were more than 1 budgetary item with the same id, this should not happen" ) @property def as_dict(self) -> dict[str, Any]: Loading