only one var

This commit is contained in:
C committed 2026-01-04 14:03:43 -08:00
1 parent 87ed932f95
commit 4a88f1ec53
1 file changed
+20 -1
+20 -1
View File
@@ -314,7 +314,26 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None):
existing_item_data["name"] = pw_name existing_item_data["name"] = pw_name
existing_item_data["description"] = f"{set_name} - {set_theme}" existing_item_data["description"] = f"{set_name} - {set_theme}"
existing_item_data["category_id"] = category_id existing_item_data["category_id"] = category_id
existing_item_data["variations"] = [variation_obj]
# Update only the specific variation, keep all others unchanged
existing_variations = existing_item_data.get("variations", [])
updated_variations = []
variation_found = False
for existing_var in existing_variations:
if existing_var.get("id") == variation_id:
# Replace this variation with our updated one
updated_variations.append(variation_obj)
variation_found = True
else:
# Keep other variations as-is
updated_variations.append(existing_var)
# If variation wasn't found (shouldn't happen), add it
if not variation_found and variation_id:
updated_variations.append(variation_obj)
existing_item_data["variations"] = updated_variations
item_obj = { item_obj = {
"type": "ITEM", "type": "ITEM",