Add cheapest-night date-range scan to the Travelodge finder
Deploy with Docker Compose / deploy (push) Successful in 52s

A second "Cheapest night" tab on /hotels scans every candidate check-in
between two dates (filtered by weekday, 1-7 nights, up to ~3 months),
keeps the N cheapest hotels per night, and prices TfL transport once per
unique hotel so the whole range fits in the streaming window.

Backend
- travelodge.py: extract _shortlist/_make_row/_price_hotels/_apply_transport
  from run_search; add a 30-minute per-(location, dates, rooms) Travelodge
  result cache, a deadline on page fetches, and run_scan (parallel date
  fetches with per-date failure isolation, one TfL lookup per hotel).
- main.py: HotelRequestBase shared by search and scan requests,
  HotelScanRequest with weekday/range validation, scan event models,
  _guarded slot wrapper, POST /hotels/scan/stream (NDJSON).
- nginx: the streaming location now matches /py/hotels/(search|scan).

Frontend
- Split CheapHotels.vue into SingleStayPanel, CheapestNightPanel,
  SharedFields, HotelRows, a shared form composable, stream/format helpers
  and hotels-shared.css; shared fields keep their values across tabs.
- Vite dev server proxies /py to the Python API.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01H5P3C1HbbEwLZEYsjwr7uV
This commit is contained in:
2026-09-08 01:38:30 +01:00
co-authored by Claude Fable 5.1
parent e445892259
commit f83d683180
15 changed files with 2430 additions and 1160 deletions
+82
View File
@@ -0,0 +1,82 @@
<script setup>
import { CUSTOM_ORIGIN } from "./useHotelForm.js";
defineProps({
form: { type: Object, required: true },
});
</script>
<template>
<label>
Search area
<input type="text" v-model="form.location" maxlength="80" required />
</label>
<label>
Rooms &amp; guests
<input
type="text"
v-model="form.guests"
placeholder='"1", "2+1", "2,2+2"'
maxlength="40"
/>
<span class="hint"
>rooms separated by commas, each ADULTS or ADULTS+CHILDREN</span
>
</label>
<label>
Railcard holders
<input
type="number"
v-model.number="form.railcardHolders"
min="0"
max="8"
/>
<span class="hint">adults getting 1/3 off off-peak rail</span>
</label>
<label>
Origin station
<select v-model="form.originKey">
<option v-for="o in form.origins" :key="o.key" :value="o.key">
{{ o.name }}
</option>
<option v-if="!form.origins.length" value="clapham junction">
Clapham Junction
</option>
<option :value="CUSTOM_ORIGIN">Custom lat,lon…</option>
</select>
<input
v-if="form.originKey === CUSTOM_ORIGIN"
type="text"
v-model="form.customOrigin"
placeholder="51.5031,-0.1132"
class="mt-1"
required
/>
</label>
<label>
Leave at
<input type="time" v-model="form.depart" required />
<span class="hint">16:00–19:00 Mon–Fri is peak (dearer, no railcard)</span>
</label>
<label>
Max miles from search area
<input
type="number"
v-model="form.maxMiles"
min="0.5"
max="50"
step="0.5"
placeholder="any"
/>
</label>
<label>
Max travel minutes
<input
type="number"
v-model.number="form.maxTravelMin"
min="10"
max="240"
/>
<span class="hint">slower routes are ignored when picking the cheapest</span>
</label>
</template>