Commit graph

65 commits

Author SHA1 Message Date
b712196262 Scraper: process-wide lock, one scrape at a time
Concurrent manual scrapes were interleaving (two Chromium sessions on one
LXC) causing the page timeouts behind partial results. SCRAPE_LOCK guards
run_manual_scrape and process_queue; the trigger endpoint returns 409 when
busy, and the frontend keeps the job queued and retries after 30s.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 16:14:55 +00:00
bf9425ee7e Market View: honest staleness per cell after partial scrapes
- matrix response gains last_scraped per date (max scraped_at across all
  hotels), so column headers show the newest scrape touching the date even
  when the visible hotels were on a failed page
- cells >1h older than the column's latest scrape render italic with *
- every cell tooltip now includes the datestamp the price was scraped

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 15:46:59 +00:00
de8c4ec257 Market View: make Scrape 7d/30d buttons gold with icon, right-aligned
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 15:19:51 +00:00
77284b3ecc Market View: Scrape 7d/30d buttons, Booking.com day-search links on date headers
- Scrape queue generalised to date-range jobs; range and per-date scrapes
  share one sequential queue (timeout scales with range length)
- Matrix refetches every 30s while a scrape runs so columns fill in live
- Eye icon per date header opens that night's location search on Booking.com

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 15:15:30 +00:00
6a3aee4db0 Market View: queue multiple per-date scrapes, dispatched sequentially
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 15:09:29 +00:00
349236cd7e Rate Analysis: fix hotel detail 500 + timeline 422, match frontend shapes; signed % delta badge
- /analysis/hotel/{id}: lead_bucket alias in ORDER BY CASE broke Postgres; replaced
  bucketed curve with per-days_ahead curve and reshaped response to the frontend
  HotelAnalysis interface (strategy/advance_curve/dow_breakdown/sold_out_pattern)
- /analysis/hotel/{id}/timeline: accept ?date= (was rate_date, 422) and return
  flat TimelineEntry array
- /analysis/hotels: alias to hotel_id/hotel_name/date_count for the selector
- strategy pcts default 0 (frontend calls .toFixed), added peak_months
- Market View badge now shows +/-% vs our rate instead of 100-index

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 15:01:57 +00:00
ea9484e3fa Market View: % suffix on price index badge, poll scrape completion for auto-refresh
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 14:51:41 +00:00
f51e1dcb76 Port occupancy sync + category ordering from the forecasting version
- Bookability showed no availability because newbook_occupancy_report_data
  was never populated: add reports_occupancy client method and
  sync_occupancy job, run before rates in both Sync Now and the daily
  schedule (single fast API call)
- Category order: default display_order to the Newbook category id on
  sync (was 0 → alphabetical), preserve manual order on re-sync, extend
  PATCH to accept display_order, add up/down reorder arrows in Settings

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 14:18:03 +00:00
69c9b16a2b Fix require_cap TypeError, rewrite /analysis/comparison, add room category sync
- require_cap was a Depends-factory but every call site uses it inline;
  make it an inline checker (fixes 500 on /analysis/hotels, /direct/*)
- /analysis/comparison returned a per-date matrix the frontend never read;
  return per-hotel aggregates (our/their avg, price index) and default to
  all active competitors so the Market Comparison table works without params
- Room categories were never populated (lost in port): add sites_list fetch
  to the Newbook client, categories list/sync/toggle endpoints, and a
  Settings card — without included categories every rates sync exits early

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 13:47:10 +00:00
c9f2dc804c Fix stale /competitor-rates/ API prefix — rename to /competitors/ throughout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:50:09 +00:00
c78c6e78e1 Fix Settings sync endpoint: refresh-all -> refresh-rates
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:42:14 +00:00
8948d3abf6 fix: TypeScript null safety fixes for strict mode
- RateAnalysis: null guard on price_incl in timeline trace
- Layout: explicit null check on alertCount, use ?? for user.name

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:18:38 +00:00
ebbffa3137 fix: TypeScript type fixes for strict mode
Add direct_hotel_id to Hotel and RateMatrixResponse interfaces,
remove as-any casts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:16:47 +00:00
3f83084223 fix: add missing tsconfig.json to frontend
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:15:51 +00:00
e05054172f Add Rate Monitor app — Booking.com + direct booking engine competitor rates
Combines Booking.com Playwright scraper (from forecasting), direct booking
engine scraper (ported from laptop-archive/guestline-monitor), and Newbook
own-hotel rates into one focused tool. Four views: Bookability, Market View
(with price index badges + direct rate sub-rows), Direct Rates (per-competitor
room breakdown, min-stay flags, hotel config/discovery), Rate Analysis
(advance purchase curve, DOW chart, rate timeline, comparison table).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:06:30 +00:00