mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-28 21:15:26 -05:00
Fix/multiple bug fixes (#1015)
* test-case for #1011 * revert regressions for #1011 * update cache key on new image * lint * fix #1012 * typing * random_recipe fixture * remove delete button when no listeners are present * spacing * update copy to match settings value
This commit is contained in:
@@ -28,7 +28,7 @@ def get_valid_call(func: Callable, args_dict) -> dict:
|
||||
return {k: v for k, v in args_dict.items() if k in valid_args}
|
||||
|
||||
|
||||
def safe_call(func, dict_args, **kwargs) -> Any:
|
||||
def safe_call(func, dict_args: dict, **kwargs) -> Any:
|
||||
"""
|
||||
Safely calls the supplied function with the supplied dictionary of arguments.
|
||||
by removing any invalid arguments.
|
||||
|
||||
@@ -33,5 +33,5 @@ class RecipeInstruction(SqlAlchemyBase):
|
||||
}
|
||||
|
||||
@auto_init()
|
||||
def __init__(self, ingredient_references, **_) -> None:
|
||||
self.ingredient_references = [RecipeIngredientRefLink(**ref) for ref in ingredient_references]
|
||||
def __init__(self, ingredient_references, session, **_) -> None:
|
||||
self.ingredient_references = [RecipeIngredientRefLink(**ref, session=session) for ref in ingredient_references]
|
||||
|
||||
@@ -129,6 +129,7 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||
"notes",
|
||||
"nutrition",
|
||||
"recipe_ingredient",
|
||||
"recipe_instructions",
|
||||
"settings",
|
||||
}
|
||||
|
||||
@@ -146,10 +147,12 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||
notes: list[dict] = None,
|
||||
nutrition: dict = None,
|
||||
recipe_ingredient: list[dict] = None,
|
||||
recipe_instructions: list[dict] = None,
|
||||
settings: dict = None,
|
||||
**_,
|
||||
) -> None:
|
||||
self.nutrition = Nutrition(**nutrition) if nutrition else Nutrition()
|
||||
self.recipe_instructions = [RecipeInstruction(**step, session=session) for step in recipe_instructions]
|
||||
self.recipe_ingredient = [RecipeIngredient(**ingr, session=session) for ingr in recipe_ingredient]
|
||||
self.assets = [RecipeAsset(**a) for a in assets]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user