fix(tradein): sber series fallback continues on error + benchmark gated to ЕКБ region (#794 review)

This commit is contained in:
bot-backend 2026-05-31 21:37:41 +03:00
parent 3485b977f1
commit 468bdb052b
2 changed files with 30 additions and 27 deletions

View file

@ -965,8 +965,8 @@ def _load_sber_index_series(db: Session, *, region: str) -> dict[date, float]:
.all()
)
except Exception as exc:
logger.warning("sber_price_index lookup failed (graceful, no-op): %s", exc)
return {}
logger.warning("sber_price_index lookup failed for %s (graceful): %s", dash, exc)
continue
if rows:
return {r["period_month"]: float(r["index_value_rub_m2"]) for r in rows}
return {}

View file

@ -380,6 +380,9 @@ async def pull_sber_indices(
latest_month.isoformat(),
latest_val,
)
# our listings median is ЕКБ-only →
# compare only against Свердловская обл. (REF_AREA 66)
if ref_area == "66":
# Task B: best-effort reconciliation to our scrape-median asking ppm²
try:
our_median = db.execute(