From 4a88f1ec5397a4cd007e1b876be5283f0a5f0936 Mon Sep 17 00:00:00 2001 From: C <0xicl33n@gmail.com> Date: Sun, 4 Jan 2026 14:03:43 -0800 Subject: [PATCH] only one var --- src/asquare.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/asquare.py b/src/asquare.py index 1a36d8c..84541a5 100644 --- a/src/asquare.py +++ b/src/asquare.py @@ -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["description"] = f"{set_name} - {set_theme}" 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 = { "type": "ITEM",