Fixed product_id
This commit is contained in:
parent
e0b643bfec
commit
d277c95895
2 changed files with 3 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue