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:
Hayden
2022-02-27 12:48:21 -09:00
committed by GitHub
parent 6a5fd8e4f8
commit 568a1a0015
11 changed files with 112 additions and 18 deletions

View File

@@ -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.

View File

@@ -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]

View File

@@ -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]