From d2f21f90a7f022bd074d975d496929c416d23c40 Mon Sep 17 00:00:00 2001 From: lekss361 Date: Sun, 17 May 2026 19:05:01 +0300 Subject: [PATCH] fix(22k): quartirography uses f.flat_type, not f.type (column doesn't exist) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- backend/app/services/analytics_queries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/services/analytics_queries.py b/backend/app/services/analytics_queries.py index 2ea75ba5..7276babb 100644 --- a/backend/app/services/analytics_queries.py +++ b/backend/app/services/analytics_queries.py @@ -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-комн.' -- 2.45.3