fix(tradein): surface same-building comps as analogs when anchor fires (#694) #708

Merged
bot-reviewer merged 1 commit from fix/694-show-anchor-analogs into main 2026-05-30 09:21:20 +00:00

1 commit

Author SHA1 Message Date
lekss361
21356b00c5 fix(tradein): surface same-building comps as analogs when anchor fires (#694)
При сработавшем same-building anchor headline строится из комплов того же дома,
а analogs[] показывали РАДИУСНЫЕ листинги (дешевле/другие) или пусто — премиум-
итог выглядел неподкреплённым (Олимп 13: 207М, analogs 41–46М; Ткачёва 13:
38М при пустом analogs[], хотя якорь на 27 комплах дома).

_fetch_anchor_comps теперь тянет display-поля (address/source/source_url/
price_rub/listing_date/days_on_market/photo_urls/lat/lon) в обоих тирах (A/C),
дедуп через _anchor_comp_from_row. При anchor_tier!=None analogs[] строится из
anchor_comps_used через _anchor_comp_to_analog (robust к отсутствующим полям:
price_rub = price_per_m2×area при отсутствии). Радиусный путь без якоря —
без изменений.

Тесты: analogs отражают anchor-комплы (ppm² 399k/472k/684k, не радиус 200–220k),
price_rub=round(ppm²×area); без якоря — радиусные; pass-through display-полей.
44 passed.

Closes #694
2026-05-30 12:05:27 +03:00