diff --git a/ingredients/__init__.py b/ingredients/__init__.py index 4d28b9c..e318c1b 100644 --- a/ingredients/__init__.py +++ b/ingredients/__init__.py @@ -39,7 +39,7 @@ def parse_ingredient_from_nlp(ingredients: List[str]) -> Ingredient: quantity=quantity, unit=unit, preparation=ingredient.preparation.text if ingredient.preparation else '', - product_id=0 + product_id=-1 )) return results diff --git a/products/__init__.py b/products/__init__.py index c1c48b3..86da4bb 100644 --- a/products/__init__.py +++ b/products/__init__.py @@ -17,7 +17,7 @@ def get_package_size(data: dict) -> str: async def create_product(link: str) -> Product: product_id = get_product_id(link) - if product_id < 0: + if not product_id: return None, None product_url = get_product_details_url(product_id) @@ -55,7 +55,7 @@ async def add_missing_tags(conn, product: Product, tags: List[str]): async def get_or_create(conn, url: str, tags: List[str]) -> Product: product_id = get_product_id(url) - if product_id < 0: + if not product_id: return None existing = await find_product_by_product_id(conn, product_id)