Fix: a booking arriving in a few days showed 'booked' instead of 'vacant'
resolveGoverningBooking() was letting an upcoming (not-today) booking govern colour, so any room with something booked within the 7-day lookahead showed green 'Booked' regardless of how far off the arrival was. 'booked' should only apply when someone's actually arriving tonight. Now a booking only governs state/colour when it covers today (arriving today, mid-stay, or departing today) — otherwise the room is genuinely vacant. The soonest upcoming booking (if any) is surfaced separately as vacant_nights, a countdown to the next arrival, purely informational and no longer tied to colour. Dashboard shows 'Vacant N nights' when something's booked within the window, or 'Vacant 7+ nights' when nothing was found in the fetched window at all. New zone_state.vacant_nights column, threaded through saveZoneState/pollOnce/status.js. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
915fc0039c
commit
dc8c9df719
5 changed files with 60 additions and 31 deletions
|
|
@ -70,6 +70,9 @@ export interface ZoneStatus extends Zone {
|
|||
current_night: number | null
|
||||
total_nights: number | null
|
||||
has_next_booking: boolean
|
||||
// Only set when room_state is 'vacant' — nights until the next known arrival within
|
||||
// the scheduler's fetch window, or null if nothing was found in that window at all.
|
||||
vacant_nights: number | null
|
||||
devices: DeviceSummary[]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue