fix(tradein/avito): persist house_type + house_catalog_url in save_detail_enrichment (#2009)
All checks were successful
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / changes (push) Successful in 10s
Deploy Trade-In / test (push) Successful in 1m33s
Deploy Trade-In / build-backend (push) Successful in 52s
Deploy Trade-In / deploy (push) Successful in 48s
All checks were successful
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / changes (push) Successful in 10s
Deploy Trade-In / test (push) Successful in 1m33s
Deploy Trade-In / build-backend (push) Successful in 52s
Deploy Trade-In / deploy (push) Successful in 48s
house_type (normalized) + house_catalog_url→house_url persisted in save_detail_enrichment; COALESCE existing-first for house_type, new-first for house_url. No migration (columns exist). Refs #2009
This commit is contained in:
parent
840d64a4a0
commit
4a93a9297c
1 changed files with 14 additions and 2 deletions
|
|
@ -677,8 +677,16 @@ def save_detail_enrichment(db: Session, e: DetailEnrichment) -> bool:
|
||||||
|
|
||||||
Returns True если строка обновлена, False если listing не найден.
|
Returns True если строка обновлена, False если listing не найден.
|
||||||
Устанавливает detail_enriched_at=NOW().
|
Устанавливает detail_enriched_at=NOW().
|
||||||
House-level поля (passenger_elevators, has_concierge, closed_yard,
|
|
||||||
total_floors_house, house_type) игнорируются — canonical из Houses Catalog (Stage 2c).
|
house_type СОХРАНЯЕТСЯ (уже нормализован парсером → канон panel/brick/monolith/
|
||||||
|
monolith_brick/block/wood) — нужен estimator soft-penalty по типу дома.
|
||||||
|
house_catalog_url СОХРАНЯЕТСЯ в listings.house_url (линковка дома); отдельной
|
||||||
|
house_catalog_url колонки нет. house_type — COALESCE existing-first (не затираем
|
||||||
|
canonical из Houses Catalog Stage 2c); house_url — new-first additive (avito-owned
|
||||||
|
поле, нет конкурирующего canonical-писателя).
|
||||||
|
Остальные house-level поля (passenger_elevators, cargo_elevators, has_concierge,
|
||||||
|
closed_yard, total_floors_house) по-прежнему опускаются — нет колонок в listings,
|
||||||
|
canonical приходит из Houses Catalog Stage 2c (отдельный follow-up).
|
||||||
"""
|
"""
|
||||||
result = db.execute(
|
result = db.execute(
|
||||||
text("""
|
text("""
|
||||||
|
|
@ -713,6 +721,8 @@ def save_detail_enrichment(db: Session, e: DetailEnrichment) -> bool:
|
||||||
total_floors = COALESCE(:total_floors, total_floors),
|
total_floors = COALESCE(:total_floors, total_floors),
|
||||||
repair_state = COALESCE(:repair_state, repair_state),
|
repair_state = COALESCE(:repair_state, repair_state),
|
||||||
price_rub = COALESCE(:price_rub, price_rub),
|
price_rub = COALESCE(:price_rub, price_rub),
|
||||||
|
house_type = COALESCE(house_type, :house_type),
|
||||||
|
house_url = COALESCE(:house_catalog_url, house_url),
|
||||||
detail_enriched_at = NOW()
|
detail_enriched_at = NOW()
|
||||||
WHERE source = 'avito' AND source_id = :item_id
|
WHERE source = 'avito' AND source_id = :item_id
|
||||||
"""),
|
"""),
|
||||||
|
|
@ -750,6 +760,8 @@ def save_detail_enrichment(db: Session, e: DetailEnrichment) -> bool:
|
||||||
"total_floors": e.total_floors,
|
"total_floors": e.total_floors,
|
||||||
"repair_state": e.repair_state,
|
"repair_state": e.repair_state,
|
||||||
"price_rub": e.price_rub,
|
"price_rub": e.price_rub,
|
||||||
|
"house_type": e.house_type,
|
||||||
|
"house_catalog_url": e.house_catalog_url,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue