naive AVG() over objective_corpus_room_month rows gives equal weight to zero-deal months, diluting per-project averages by 2-10x. Projects with sparse deal history (e.g. 5 active months out of 24) were shown avg_area ≈27m² instead of the correct ≈81m² for 3-room flats. Replace both aggregates with SUM(val*cnt)/NULLIF(SUM(cnt),0) so only months with actual deals contribute weight. NULLIF prevents division-by-zero and returns NULL for all-zero projects instead of a misleading 0. Prod check (Vitamin-квартал на Титова, last 24 mo): studio 26m²/176k, 1-rm 37m²/174k, 2-rm 56m²/135k, 3-rm 81m²/136k — matches expected ranges. |
||
|---|---|---|
| .. | ||
| api | ||
| integration | ||
| scrapers | ||
| services | ||
| smoke | ||
| sql | ||
| workers | ||
| __init__.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_poi_score.py | ||
| test_quarter_dump_lookup.py | ||
| test_rbac.py | ||
| test_sentry_init.py | ||
| test_velocity.py | ||
| test_weight_profiles.py | ||