fix(tradein): backfill kn price_per_m2 via sale_graph + peer median (#573) #625

Merged
Light1YT merged 2 commits from fix/573-kn-price-per-m2-backfill into main 2026-05-28 13:50:46 +00:00
Showing only changes of commit 36bdda9290 - Show all commits

View file

@ -1,4 +1,4 @@
-- 100_backfill_kn_price_per_m2.sql
-- 120_backfill_kn_price_per_m2.sql
-- Context: Issue #573 — domrf_kn_flats.price_per_m2 is populated in only ~3.7%
-- of rows (status='free'/'sold'/'booked'). The 756 977 NULL-status rows imported
-- from historical DOM.RF snapshots carry total_area but no price_rub, so the
@ -68,7 +68,7 @@ WITH peer AS (
GROUP BY obj_id
)
UPDATE public.domrf_kn_flats f
SET price_per_m2 = ROUND(p.median_ppm2, 2)
SET price_per_m2 = ROUND(p.median_ppm2::numeric, 2)
FROM peer p
WHERE f.obj_id = p.obj_id
AND f.price_per_m2 IS NULL;