Commit graph

8 commits

Author SHA1 Message Date
75c2adf803 Fix Booking.com scrape saves — widen room_type to TEXT + rollback per failure
Scraped room descriptions exceed VARCHAR(100) (StringDataRightTruncation),
and the failed insert poisoned the transaction so every subsequent save in
the batch died with InFailedSqlTransaction — scrapes reported success with
0 rows saved. Widen the column (with ALTER for existing tables) and roll
back after a failed save.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 14:32:20 +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
c924d793e8 Fix scheduled Newbook sync — await the coroutine instead of run_in_executor
run_fetch_current_rates is async; run_in_executor called it in a thread
and discarded the coroutine, so the daily scheduled sync silently did
nothing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 14:09:40 +00:00
33d466ed73 Fix newbook_current_rates column names + rollback on failed date
- schema defined gross_rate/net_rate but every query (fetch job,
  bookability, competitors) uses rate_gross/rate_net — rename the
  columns, with an idempotent DO-block migration for existing tables
- roll back the session when a date fails so one bad statement no
  longer poisons the whole sync run (every subsequent write was dying
  with 'current transaction is aborted')

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 14:07:01 +00:00
4977768645 Fix sites_list category field names — category_id/category_name, not site_category_*
The rates Newbook instance returns categories as category_id/category_name
on each site; also skip inactive categories.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 14:01:07 +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
d94b8feee6 Add GET/POST /competitors/config/system endpoints for Settings page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-05 12:30:29 +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