weighted_avg_velocity was a naive mean despite the name — a 500-flat ЖК weighed the same as a 20-flat one. Now count-weighted by flats_total (sql.md AVG principle): Σ(velocity*flats_total)/Σ(flats_total). Competitors with unknown flats_total are excluded from weights; if sizes are unknown for ALL, graceful fallback to the simple mean (den>0 guard). Field name + API contract UNCHANGED (zero consumer ripple — traced: only CompetitorsSummary, no frontend ref). Tests: equal sizes → weighted==naive (existing 6.0 stays); NEW test with 500-flat@40 + 20-flat@2 → 38.54 (not naive 21.0), proving the weighting. |
||
|---|---|---|
| .. | ||
| api | ||
| integration | ||
| scrapers | ||
| scripts | ||
| services | ||
| smoke | ||
| sql | ||
| workers | ||
| __init__.py | ||
| conftest.py | ||
| test_admin_weight_profiles.py | ||
| test_concepts_stub.py | ||
| test_gate_verdict.py | ||
| test_health.py | ||
| test_layout_signature.py | ||
| test_layout_tz_pdf.py | ||
| test_nspd_client.py | ||
| test_nspd_sync.py | ||
| test_ping.py | ||
| test_poi_score.py | ||
| test_quarter_dump_lookup.py | ||
| test_rbac.py | ||
| test_sentry_init.py | ||
| test_velocity.py | ||
| test_weight_profiles.py | ||