Room planner: fix next-bracket visibility and vacant room misdetection
Extend booking fetch window to day-after-tomorrow so tomorrow-arriving bookings appear in nextBooking lookups (some NewBook regions exclude arrivals exactly on period_to date, causing right brackets to not render). Add booking_site_id fallback in site-ID matching so bookings are found correctly even when NewBook returns booking_site_id instead of site_id in the booking object (was causing some rooms to show as vacant). Remove category debug logging (no longer needed). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
cbfec7d591
commit
916dc50390
2 changed files with 12 additions and 12 deletions
|
|
@ -74,24 +74,18 @@ export async function roomRoutes(app) {
|
|||
// Fetch from NewBook in parallel
|
||||
let sites, bookings, tasks
|
||||
try {
|
||||
// Fetch bookings one day beyond tomorrow so tomorrow-arriving bookings appear
|
||||
// in nextBooking lookups (some NewBook regions exclude period_to-date arrivals).
|
||||
const dayAfterTomorrow = dateOffset(viewDate, +2)
|
||||
;[sites, bookings, tasks] = await Promise.all([
|
||||
fetchSites(),
|
||||
fetchBookings(yesterday, tomorrow),
|
||||
fetchBookings(yesterday, dayAfterTomorrow),
|
||||
fetchTasks(yesterday, tomorrow),
|
||||
])
|
||||
} catch (err) {
|
||||
return reply.status(502).send({ error: `NewBook fetch failed: ${err.message}` })
|
||||
}
|
||||
|
||||
// Derive category map from sites. Log first site keys to help diagnose field names.
|
||||
if (sites.length > 0) {
|
||||
const sample = sites[0]
|
||||
console.log('[rooms] sample site keys:', Object.keys(sample))
|
||||
console.log('[rooms] sample site_category_id:', sample.site_category_id,
|
||||
'| category_id:', sample.category_id,
|
||||
'| category:', JSON.stringify(sample.category))
|
||||
}
|
||||
|
||||
const categoryMap = {}
|
||||
for (const site of sites) {
|
||||
const catId = String(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue