This commit is contained in:
C committed 2026-01-04 13:43:09 -08:00
1 parent 48a8a5ce54
commit 931341751d
1 file changed
+7 -10
+7 -10
View File
@@ -272,25 +272,22 @@ 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")
# batch_get doesn't return category_id, so use original item_data if available
# CRITICAL: batch_get NEVER returns category_id (always None)
# We MUST use the category from initial item_data (from search which includes category)
# or fallback to LEGO_CAT_ID since we know this is a LEGO item
if item_data and item_data.get("category_id"):
category_id = item_data.get("category_id")
print(f"[@DEBUG] Using category_id from item_data: {category_id}")
else:
category_id = fresh_item.get("category_id") or LEGO_CAT_ID
# Fallback to LEGO_CAT_ID (we know it's a LEGO item if enrichment was triggered)
category_id = LEGO_CAT_ID
print(
f"[@DEBUG] Category ID from fresh_item: {fresh_item.get('category_id')}"
)
if not fresh_item.get("category_id"):
print(
f"[@WARNING] No category_id in fresh_item, using LEGO_CAT_ID: {LEGO_CAT_ID}"
f"[@WARNING] No category_id in item_data, using LEGO_CAT_ID: {LEGO_CAT_ID}"
)
print(f"[@DEBUG] Fresh item version: {current_version}")
print(f"[@DEBUG] Fresh variation version: {variation_version}")
print(f"[@DEBUG] Final category_id: {category_id}")
print(f"[@DEBUG] Present at all locations: {present_at_all_locations}")
print(f"[@DEBUG] Present at locations: {present_at_location_ids}")
print(f"[@DEBUG] Final category_id for upsert: {category_id}")
# Build upsert body
variation_obj = {