From 0b4aa0181bbf68d462a94df2e31a1d6763fca625 Mon Sep 17 00:00:00 2001 From: Malin Date: Mon, 23 Mar 2026 10:25:44 +0100 Subject: [PATCH] feat: strip MTZ internal suffix from descriptions Removes trailing " (NNNNN) - Country - Npcs ByBox" pattern from product descriptions before serving to BC. Co-Authored-By: Claude Sonnet 4.6 --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index f49738b..dba24bb 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ import os +import re import threading import time import requests @@ -86,11 +87,12 @@ def download_and_parse(): brand_raw = row[9] # col J brand = str(brand_raw) if brand_raw is not None else "" min_box_raw = row[10] # col K + description = re.sub(r'\s*\(\d+\).*$', '', str(row[2] or "")).strip() parsed.append( { "item_code": safe_int(row[1], 0), "ean": ean, - "description": str(row[2] or ""), + "description": description, "price_usd": safe_float(row[4], 0.0), "stock": safe_int(row[5], 0), "brand": brand,