fix: VK Market write API expects rubles, read amount field is kopecks

market.add/edit accept price in rubles; market.get returns price.amount
in kopecks. Cache stores rubles (amount/100), send rubles on write.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mguschin
2026-05-12 22:49:13 +03:00
parent 3ad383d00b
commit e0e43f3fc3
2 changed files with 11 additions and 12 deletions

View File

@@ -104,10 +104,9 @@ def _sync_user(db, user_id: int, token: str, group_id: str) -> None:
album_id = str(p["albums_ids"][0]) if p.get("albums_ids") else None
price_field = p.get("price")
if isinstance(price_field, dict):
price_raw = price_field.get("amount")
price = float(price_raw) / 100 if price_raw is not None else None
price = float(price_field.get("amount", 0)) / 100 if price_field.get("amount") is not None else None
else:
price = float(price_field) / 100 if price_field is not None else None
price = float(price_field) if price_field is not None else None
thumb = None
thumb_field = p.get("thumb_photo")
if isinstance(thumb_field, dict):