Fix max_persons extraction and legend truncation in rate modal
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
121976b3db
commit
dbcc15661d
2 changed files with 6 additions and 6 deletions
|
|
@ -73,10 +73,10 @@ _EXTRACT_RATES_JS = """
|
||||||
const cancelMatch = condCell.match(/free cancellation before ([\\w\\s]+)/i);
|
const cancelMatch = condCell.match(/free cancellation before ([\\w\\s]+)/i);
|
||||||
const freeCancelText = cancelMatch ? cancelMatch[1].trim() : null;
|
const freeCancelText = cancelMatch ? cancelMatch[1].trim() : null;
|
||||||
|
|
||||||
// Persons: first <td> ("Max persons: 2" or "Only for 1 guest")
|
// Persons: extract from block_id format {room_id}_{rate_plan_id}_{persons}_{meal}_0
|
||||||
const personsCell = cells.length >= 1 ? cells[0].innerText || '' : '';
|
// More reliable than cell text parsing which can pick up the price instead.
|
||||||
const personsMatch = personsCell.match(/\\d+/);
|
const blockParts = blockId.split('_');
|
||||||
const maxPersons = personsMatch ? parseInt(personsMatch[0]) : null;
|
const maxPersons = blockParts.length >= 3 ? parseInt(blockParts[2]) : null;
|
||||||
|
|
||||||
// Quantity dropdown: last <td> has a <select> with options 0..N
|
// Quantity dropdown: last <td> has a <select> with options 0..N
|
||||||
// where N = actual available qty (capped at 10 by Booking.com).
|
// where N = actual available qty (capped at 10 by Booking.com).
|
||||||
|
|
|
||||||
|
|
@ -1248,9 +1248,9 @@ const RateHistoryModalComponent: React.FC<{ modal: RateHistoryModal; onClose: ()
|
||||||
<Plot
|
<Plot
|
||||||
data={traces}
|
data={traces}
|
||||||
layout={{
|
layout={{
|
||||||
margin: { t: 10, r: 10, b: 50, l: 55 },
|
margin: { t: 10, r: 10, b: 65, l: 55 },
|
||||||
height: 300,
|
height: 300,
|
||||||
legend: { orientation: 'h', y: -0.25 },
|
legend: { orientation: 'h', y: -0.3, namelength: -1 },
|
||||||
xaxis: { title: { text: '' }, tickformat: '%d %b %H:%M', type: 'date' },
|
xaxis: { title: { text: '' }, tickformat: '%d %b %H:%M', type: 'date' },
|
||||||
yaxis: { title: { text: 'Rate (£)' }, tickprefix: '£', tickformat: ',.0f' },
|
yaxis: { title: { text: 'Rate (£)' }, tickprefix: '£', tickformat: ',.0f' },
|
||||||
plot_bgcolor: 'var(--body-bg)',
|
plot_bgcolor: 'var(--body-bg)',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue