diff --git a/src/asquare.py b/src/asquare.py index e7b86b2..08d337c 100644 --- a/src/asquare.py +++ b/src/asquare.py @@ -261,11 +261,19 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None): # Get current version for version control current_version = fresh_item.get("version") - category_id = fresh_item.get("category_id") or LEGO_CAT_ID + category_id = fresh_item.get("category_id") + print(f"[@DEBUG] Fresh item data: {fresh_item}") print(f"[@DEBUG] Fresh item version: {current_version}") print(f"[@DEBUG] Fresh variation version: {variation_version}") - print(f"[@DEBUG] Category ID: {category_id}") + print(f"[@DEBUG] Category ID from fresh_item: {category_id}") + + # Ensure we have a category_id + if not category_id: + print( + f"[@WARNING] No category_id in fresh_item, using LEGO_CAT_ID: {LEGO_CAT_ID}" + ) + category_id = LEGO_CAT_ID # Build upsert body variation_obj = { @@ -307,6 +315,7 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None): del variation_obj["item_variation_data"]["sku"] print(f"[@DEBUG] Upserting item {item_id} with name: {pw_name}") + print(f"[@DEBUG] Upsert body: {json.dumps(upsert_body, indent=2)}") # Perform upsert using catalog.object.upsert try: