Replacing a result x for result y is easy:
But what if I remove result x and this was the main_product? Setting a new main_product is easy when I work on a single recipe -- but not if I want to loop over all available recipes. Sure, I could use the first result, or the one with the highest amount, or the only one without probability, but all of that seems to be only half-baked. Did anybody else already think about this?
Code: Select all
if recipe.results["x"].name == recipe.main_product then recipe.main_product = recipe.results["y"].name end