From 4fba436a61d481aeb81491bf42a52b8f41766f2c Mon Sep 17 00:00:00 2001 From: Tom Bursch Date: Tue, 2 May 2023 17:20:30 +0200 Subject: [PATCH] fix: bug failed to add recipe with new items (#30) --- app/controller/shoppinglist/shoppinglist_controller.py | 1 - app/models/item.py | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controller/shoppinglist/shoppinglist_controller.py b/app/controller/shoppinglist/shoppinglist_controller.py index 9369814..9838971 100644 --- a/app/controller/shoppinglist/shoppinglist_controller.py +++ b/app/controller/shoppinglist/shoppinglist_controller.py @@ -181,7 +181,6 @@ def addShoppinglistItemByName(args, id): item = Item.find_by_name(shoppinglist.household_id, args['name']) if not item: item = Item.create_by_name(shoppinglist.household_id, args['name']) - # item.checkAuthorized() con = ShoppinglistItems.find_by_ids(shoppinglist.id, item.id) if not con: diff --git a/app/models/item.py b/app/models/item.py index 50a0815..1626f34 100644 --- a/app/models/item.py +++ b/app/models/item.py @@ -54,10 +54,10 @@ def obj_to_export_dict(self) -> dict: def save(self, keepDefault=False) -> Self: if not keepDefault: self.default = False - super().save() + return super().save() @classmethod - def create_by_name(cls, household_id: int, name: str, default=False) -> Self: + def create_by_name(cls, household_id: int, name: str, default: bool = False) -> Self: return cls( name=name.strip(), default=default,