From 30583c59a4cea13417ba21bac2895e1f7254db66 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Fri, 10 Jul 2026 00:03:17 +0000 Subject: [PATCH] Restrict hotel-page scraper to own + competitor tiers only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Market-tier hotels were auto-discovered from search results and don't need room-level rate tracking — scraping all 25+ of them per date was unnecessary. Only 'own' and 'competitor' hotels are now scraped. Co-Authored-By: Claude Sonnet 4.6 --- backend/services/booking_scraper.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/services/booking_scraper.py b/backend/services/booking_scraper.py index fa8b0c1..5fdffce 100644 --- a/backend/services/booking_scraper.py +++ b/backend/services/booking_scraper.py @@ -295,12 +295,16 @@ def cleanup_stale_batches(db: Session, max_age_minutes: int = 60): def get_active_hotels(db: Session) -> List[Dict[str, Any]]: - """Return all active hotels that have a booking_com_url (needed for hotel-page scraping).""" + """Return own + competitor hotels with a booking_com_url (for hotel-page scraping). + Market-tier hotels are excluded — they were auto-discovered from search results and + are not hotels we specifically want to track at rate-plan level.""" 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 + WHERE is_active = TRUE + AND booking_com_url IS NOT NULL + AND tier IN ('own', 'competitor') ORDER BY display_order, id """) ).fetchall()