From c386ce70ceb00fe6be5b65f11989260226b8a66a Mon Sep 17 00:00:00 2001 From: Dyllan Macias Date: Fri, 2 Feb 2024 09:54:36 -0600 Subject: [PATCH 1/2] Add done attribute to shopping list --- pygrocy/data_models/product.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pygrocy/data_models/product.py b/pygrocy/data_models/product.py index 62bc500..42af656 100644 --- a/pygrocy/data_models/product.py +++ b/pygrocy/data_models/product.py @@ -209,6 +209,7 @@ def __init__(self, raw_shopping_list: ShoppingListItem): self._note = raw_shopping_list.note self._amount = raw_shopping_list.amount self._product = None + self._done = raw_shopping_list.done def get_details(self, api_client: GrocyApiClient): if self._product_id: @@ -233,3 +234,7 @@ def note(self) -> str: @property def product(self) -> Product: return self._product + + @property + def done(self) -> int: + return self._done From 1e3045ca6b6e488242e237464e1232ac30cef685 Mon Sep 17 00:00:00 2001 From: Dyllan Macias Date: Fri, 2 Feb 2024 10:04:42 -0600 Subject: [PATCH 2/2] Add test condition --- test/test_shoppinglist.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_shoppinglist.py b/test/test_shoppinglist.py index 2cc40c6..26ade75 100644 --- a/test/test_shoppinglist.py +++ b/test/test_shoppinglist.py @@ -14,6 +14,7 @@ def test_get_shopping_list_valid(self, grocy): for item in shopping_list: assert isinstance(item, ShoppingListProduct) assert isinstance(item.id, int) + assert isinstance(item.done, int) if item.product_id: assert isinstance(item.product_id, int) assert isinstance(item.product, Product)