Light1YT
c5d1069e2c
fix(tradein): per-bucket velocity uses district+class competitors (#574)
Deep-review BLOCK: prior fix divided market velocity by region-wide active
ЖК count (~442) → срок продажи 379-1180 мес (нереалистично).
FIX: divide by district+class competitor count (competitors_weighted from
_active_competitors_count cascade, ~5-15 ЖК) in BOTH fallback sites —
aggregate and per-bucket. Срок now lands ~12-24 мес.
- Delete unused _n_active_zhk_region helper + lazy _n_active_cache closure.
- n_comp = max(round(competitors_weighted), 1) — district+class, not region-wide.
- Rename scope["n_active_region"] → scope["n_competitors"] (new field this
branch, nothing else reads it; frontend confirmed clean).
- Keep static-mix fix: per-bucket velocities stay keyed off MARKET
bucket_deal_counts (independent of user share_pct slider).
- Tests: drop TestNActiveZhkRegion (helper removed); retarget n_active_region
→ n_competitors via _competitors_two_dim mock; replace misleading "≈404 мес"
comment with assertion 12<=срок<=24 across n_comp 5-15.