diff --git a/backend/app/api/v1/parcels.py b/backend/app/api/v1/parcels.py index b0dae3b2..305bdac5 100644 --- a/backend/app/api/v1/parcels.py +++ b/backend/app/api/v1/parcels.py @@ -512,7 +512,7 @@ def analyze_parcel( by_category: dict[str, list[dict[str, Any]]] = {} # X1 (#47): per-POI breakdown с verbal explain для UI factors_detailed: list[dict[str, Any]] = [] - for p in poi_rows: + for idx, p in enumerate(poi_rows): cat: str = p["category"] w = _POI_WEIGHTS.get(cat, 0.0) # distance decay: 1.0 на 0м, 0.5 на ~500м, ~0 на 1000м @@ -536,7 +536,10 @@ def analyze_parcel( continue factors_detailed.append( { - "factor": f"{cat}_{round(distance_m)}m", + # Include idx чтобы избежать React key collision: два POI одной + # категории на одинаково округлённом расстоянии иначе дали бы + # дубль (например, two аптеки 450м в плотном районе). + "factor": f"{cat}_{round(distance_m)}m_{idx}", "category": cat, "category_ru": _POI_CATEGORY_RU.get(cat, cat), "group": _POI_GROUP.get(cat, "Прочее"),