fix(22k): quartirography uses f.flat_type, not f.type (column doesn't exist)

POST-merge bug — /api/v1/analytics/object/{id}/quartirography returned 500
because SQL referenced f.type, but domrf_kn_flats has flat_type column.

Verified via DB: query now returns 4 buckets (Нежилые/1-3-комн.) for obj=65136.

Affected endpoint: GET /api/v1/analytics/object/{obj_id}/quartirography
This commit is contained in:
lekss361 2026-05-17 19:05:01 +03:00
parent f8c382f885
commit d2f21f90a7

View file

@ -985,8 +985,8 @@ def object_flats_quartirography(db: Session, obj_id: int) -> list[dict[str, Any]
)
SELECT
CASE
WHEN f.rooms IS NULL OR LOWER(f.type) LIKE '%нежил%'
OR LOWER(f.type) LIKE '%nonliv%' THEN 'Нежилые'
WHEN f.rooms IS NULL OR LOWER(f.flat_type) LIKE '%нежил%'
OR LOWER(f.flat_type) LIKE '%nonliv%' THEN 'Нежилые'
WHEN f.rooms = 0 THEN 'Студия'
WHEN f.rooms = 1 THEN '1-комн.'
WHEN f.rooms = 2 THEN '2-комн.'