Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Add done attribute to shopping list #277

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pygrocy/data_models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -233,3 +234,7 @@ def note(self) -> str:
@property
def product(self) -> Product:
return self._product

@property
def done(self) -> int:
return self._done
1 change: 1 addition & 0 deletions test/test_shoppinglist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm a bit out-of-the-loop regarding grocy, is int the correct type for done. Sounds like it should be a boolean.

if item.product_id:
assert isinstance(item.product_id, int)
assert isinstance(item.product, Product)
Expand Down
Loading