fix: sync Evotor description to VK as-is, remove generated wrapper text
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -39,13 +39,6 @@ def _calc_price(price: Decimal | None) -> float:
|
||||
return float(price)
|
||||
|
||||
|
||||
def _build_description(name: str, measure: str | None, evo_description: str | None) -> str:
|
||||
price_info = (measure or "").strip()
|
||||
desc = f"{name} (цена за {price_info}.)\n\n"
|
||||
if evo_description:
|
||||
desc += evo_description
|
||||
return desc
|
||||
|
||||
|
||||
def _name_for_vk(name: str) -> str:
|
||||
return name.replace(";", ",")
|
||||
@@ -158,7 +151,7 @@ def _sync_product(
|
||||
) -> None:
|
||||
name = _name_for_vk(product.name)
|
||||
price_rubles = _calc_price(product.price)
|
||||
desc = _build_description(product.name, product.measure_name, None)
|
||||
desc = (product.description or "").strip()
|
||||
stock = settings.VK_STOCK_AMOUNT if product.allow_to_sell else 0
|
||||
owner_id = f"-{vk_group_id}"
|
||||
now = _now()
|
||||
@@ -177,7 +170,7 @@ def _sync_product(
|
||||
vk_stock = settings.VK_STOCK_AMOUNT if vk_p.availability == 0 else 0
|
||||
vk_name = vk_p.name or ""
|
||||
vk_desc = (vk_p.description or "").strip()
|
||||
curr_desc = desc.strip()
|
||||
curr_desc = desc
|
||||
album_changed = str(vk_p.album_id) != str(album_id) if album_id else False
|
||||
changed = (
|
||||
name != vk_name
|
||||
@@ -196,7 +189,7 @@ def _sync_product(
|
||||
"owner_id": owner_id,
|
||||
"item_id": product.vk_product_id,
|
||||
"name": name,
|
||||
"description": desc.strip(),
|
||||
"description": desc,
|
||||
"category_id": settings.VK_CATEGORY_ID,
|
||||
"price": price_rubles,
|
||||
"stock_amount": stock,
|
||||
|
||||
Reference in New Issue
Block a user