From b4410dc3c02f8c3989205af7b4ff170dddd61b10 Mon Sep 17 00:00:00 2001 From: mitaa Date: Tue, 17 Sep 2024 05:41:03 +0200 Subject: [PATCH] Handle unrecognized recipe names --- src/production_planner/core.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/production_planner/core.py b/src/production_planner/core.py index fac40e7..a38fe0b 100644 --- a/src/production_planner/core.py +++ b/src/production_planner/core.py @@ -653,8 +653,11 @@ def node_constructor(loader, node): if data["recipe"] in prod.recipe_map: node.recipe = prod.recipe_map[data["recipe"]] else: - node.recipe = prod.recipe_map["Alternate: " + data["recipe"]] - # TODO: do not fail on unrecognized recipe + alternate = "Alternate: " + data["recipe"] + if alternate in prod.recipe_map: + node.recipe = prod.recipe_map["Alternate: " + data["recipe"]] + else: + node.recipe = Recipe(f"! { data['recipe'] }", 60, [], [], False) node.update() return node