The comparables block on /analytics/recommend was showing the same ЖК multiple times (ЖК СТАРТ × 3, ЭХО ЛЕСА × 2 etc) because domrf_kn_objects has ~3 historical snapshots per obj_id. The previous query joined all rows and LIMIT 5 cherry-picked duplicates by flat_count. Fix: wrap base in CTE `latest_obj` with `DISTINCT ON (obj_id) ORDER BY obj_id, snapshot_date DESC` to pick only the latest snapshot per object before sorting by flat_count. |
||
|---|---|---|
| .. | ||
| api | ||
| core | ||
| models | ||
| schemas | ||
| services | ||
| workers | ||
| __init__.py | ||
| main.py | ||