Fix SKU conversion: rootSV base + '01', not base + variant

rootSV '0419363_1' was producing '4193631' (wrong)
Now correctly produces '41936301' (confirmed by user)

The '_N' suffix is a variant/image index, not part of the SKU.
Pattern: strip leading zero from base, append '01'.
This commit is contained in:
2026-03-21 23:06:05 -07:00
parent c0ec0f947b
commit f71df3f558

View File

@@ -80,13 +80,15 @@ def extract_products_from_har(har_path: str) -> list[dict]:
def rootsv_to_sku(rootsv: str) -> str: def rootsv_to_sku(rootsv: str) -> str:
"""Convert rootSV like '0419363_1' to SKU like '41936301'.""" """Convert rootSV like '0419363_1' to SKU like '41936301'.
The rootSV base (minus leading zero) + '01' gives the DG item number.
The '_N' suffix is a variant/image index, not part of the SKU.
"""
if not rootsv: if not rootsv:
return "" return ""
parts = rootsv.split("_") base = rootsv.split("_")[0].lstrip("0")
base = parts[0].lstrip("0") return base + "01"
suffix = parts[1] if len(parts) > 1 else ""
return base + suffix
def build_product_url(upc: str) -> str: def build_product_url(upc: str) -> str: