From dbcc15661de653f91b1542f909043af726d40d81 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Thu, 9 Jul 2026 23:49:18 +0000 Subject: [PATCH] Fix max_persons extraction and legend truncation in rate modal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Scraper: extract max_persons from block_id (3rd segment) instead of cell text; cell[0] was picking up the price value (e.g. 189/166) causing the max_persons=2 filter to exclude all scraped rows and show "No rates available" in snapshot - MarketView: add namelength: -1 to Plotly legend to prevent label truncation; increase bottom margin from 50→65 and legend y from -0.25→-0.3 Co-Authored-By: Claude Sonnet 4.6 --- .../services/scraper_backends/playwright_hotel_page.py | 8 ++++---- frontend/src/pages/MarketView.tsx | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/services/scraper_backends/playwright_hotel_page.py b/backend/services/scraper_backends/playwright_hotel_page.py index 64276a4..0814299 100644 --- a/backend/services/scraper_backends/playwright_hotel_page.py +++ b/backend/services/scraper_backends/playwright_hotel_page.py @@ -73,10 +73,10 @@ _EXTRACT_RATES_JS = """ const cancelMatch = condCell.match(/free cancellation before ([\\w\\s]+)/i); const freeCancelText = cancelMatch ? cancelMatch[1].trim() : null; - // Persons: first ("Max persons: 2" or "Only for 1 guest") - const personsCell = cells.length >= 1 ? cells[0].innerText || '' : ''; - const personsMatch = personsCell.match(/\\d+/); - const maxPersons = personsMatch ? parseInt(personsMatch[0]) : null; + // Persons: extract from block_id format {room_id}_{rate_plan_id}_{persons}_{meal}_0 + // More reliable than cell text parsing which can pick up the price instead. + const blockParts = blockId.split('_'); + const maxPersons = blockParts.length >= 3 ? parseInt(blockParts[2]) : null; // Quantity dropdown: last has a