Estimator ADDITIVELY derives expected_sold from asking-median × per-rooms asking_to_sold_ratio (table from #648 S2 / migration 080). Headline asking median, ranges, confidence and actual_deals are UNCHANGED. Graceful: missing/ empty ratio table → expected_sold fields None, estimate still returns 200 (ratio lookup rolls back the shared session on error so the subsequent INSERT isn't poisoned — mirrors sibling cache helpers). - estimator: _get_asking_sold_ratio(db, rooms) cached lookup (per-rooms → global -1 fallback → None, try/except+rollback), applied after repair-coef. - schema: 6 optional expected_sold_* / ratio fields on AggregatedEstimate. - api: rehydrate the new columns in GET /estimate/{id} + /pdf reopen SELECTs and both constructors (the documented reopen-path bug). - migration 081: ADD COLUMN IF NOT EXISTS for the persisted subset. - tests: 10 new (lookup/apply/graceful) + fix pre-existing test_estimator_ source_quota 2→3 tuple unpack of _fetch_analogs (was RED on main). |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| admin.py | ||
| brand.py | ||
| geocode.py | ||
| me.py | ||
| search.py | ||
| trade_in.py | ||