feat(tradein): daily asking→sold ratio refresh (#648 S4) #663

Merged
Light1YT merged 1 commit from feat/648-s4-ratio-refresh into main 2026-05-29 13:49:37 +00:00

1 commit

Author SHA1 Message Date
fc707f16e8 feat(tradein): daily asking→sold ratio refresh (#648 S4)
Scheduled job recompute_asking_to_sold_ratios re-derives asking_to_sold_ratios
daily so the estimator's asking→sold correction doesn't go stale as nightly
ДКП deals import. TRUE-MIRROR refresh: DELETE WHERE district='' + re-run the
080 derivation INSERT...SELECT in one transaction (atomic, single commit) —
drops stale per-rooms rows that fall below the 30/30 threshold, which the 080
ON CONFLICT DO UPDATE seed would have left behind.

- app/tasks/asking_to_sold_ratio.py: sync task (run_in_executor); derivation
  byte-identical to migration 080; returns/logs counters; rollback+mark_failed
  +re-raise on error.
- scheduler.py: trigger_asking_to_sold_ratio_run + dispatch (mirrors #570 snapshot).
- migration 082: seed scrape_schedules enabled=true, window 06:00-07:00 UTC
  (after rosreestr import), ON CONFLICT DO NOTHING.
- 26 tests.
2026-05-29 18:49:27 +05:00