This commit is contained in:
C committed 2026-01-04 13:38:48 -08:00
1 parent 7296927cea
commit 48a8a5ce54
1 file changed
+16 -10
+16 -10
View File
@@ -271,21 +271,27 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None):
# Get current version for version control # Get current version for version control
current_version = fresh_item.get("version") current_version = fresh_item.get("version")
category_id = fresh_item.get("category_id")
# batch_get doesn't return category_id, so use original item_data if available
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
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}"
)
print(f"[@DEBUG] Fresh item version: {current_version}") print(f"[@DEBUG] Fresh item version: {current_version}")
print(f"[@DEBUG] Fresh variation version: {variation_version}") print(f"[@DEBUG] Fresh variation version: {variation_version}")
print(f"[@DEBUG] Category ID from fresh_item: {category_id}") print(f"[@DEBUG] Final category_id: {category_id}")
print(f"[@DEBUG] Present at all locations: {present_at_all_locations}") print(f"[@DEBUG] Present at all locations: {present_at_all_locations}")
print(f"[@DEBUG] Present at locations: {present_at_location_ids}") print(f"[@DEBUG] Present at locations: {present_at_location_ids}")
# 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 # Build upsert body
variation_obj = { variation_obj = {
"type": "ITEM_VARIATION", "type": "ITEM_VARIATION",
@@ -319,7 +325,7 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None):
"variations": [variation_obj], "variations": [variation_obj],
}, },
} }
upsert_body = { upsert_body = {
"idempotency_key": str(uuid.uuid4()), "idempotency_key": str(uuid.uuid4()),
"object": item_obj, "object": item_obj,