hvac/backend
jtricerolph 99ec8b9747 Fix same-day turnover: pick the most-active booking per site, not just the first
pollOnce() previously collapsed multiple bookings overlapping today for one site
down to a single candidate before computing room_state, with a weak tie-break
(prefer 'arrived' status, else whichever the API happened to return first). On a
same-day turnover — departing guest + incoming guest both returned by NewBook's
'staying' list for the same site — if neither was marked 'arrived' yet, this could
arbitrarily lock onto the incoming guest's booking (still in 'booked', prep not
started) instead of the departing guest's (which should be 'cooling_down'), even
though the departing guest was the one actually still checked into the room.

Now every candidate booking for a site is evaluated (each zone applies its own
offsets, so this only resolves once we have the zone), and the state machine picks
whichever produces the most active result: occupied > heating_up > cooling_down >
booked > vacant. Zero behaviour change for the common single-booking-per-site case.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 09:55:35 +00:00
..
scripts Add Phase 2 MHI Modbus register-map profile, xlsx importer, and a 2026-07-27 14:19:58 +00:00
src Fix same-day turnover: pick the most-active booking per site, not just the first 2026-08-25 09:55:35 +00:00
Dockerfile Scaffold Phase 1 hvac app — NewBook-driven room TRV heating scheduler 2026-07-26 18:00:42 +00:00
package.json Add MHI aircon manual control (Phase 2, Modbus only) 2026-07-27 14:43:38 +00:00