Fix own hotel excluded from scrape and 1-person rates hidden in matrix

Include tier=own in get_active_hotels() so the own hotel Booking.com
listing is scraped alongside competitors. Change matrix max_persons
filter from hard WHERE to ORDER BY priority so hotels with only
1-person rates (e.g. Old Stocks) still show up rather than being
silently excluded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-10 00:31:08 +00:00
parent ca76bc2f90
commit dd84ca230a
2 changed files with 10 additions and 8 deletions

View file

@ -295,16 +295,16 @@ def cleanup_stale_batches(db: Session, max_age_minutes: int = 60):
def get_active_hotels(db: Session) -> List[Dict[str, Any]]:
"""Return competitor hotels with a booking_com_url (for hotel-page scraping).
Own and market hotels are excluded market were auto-discovered from search results;
own hotel rates come from the Newbook API, not Booking.com scraping."""
"""Return own + competitor hotels with a booking_com_url (for hotel-page scraping).
Market hotels are excluded they are auto-discovered from search results and not
individually monitored. Own hotel IS included so its Booking.com listing is tracked."""
rows = db.execute(
text("""
SELECT id, booking_com_id, name, booking_com_url
FROM booking_com_hotels
WHERE is_active = TRUE
AND booking_com_url IS NOT NULL
AND tier = 'competitor'
AND tier IN ('own', 'competitor')
ORDER BY display_order, id
""")
).fetchall()