All problems

Overnight Observatory Bookings Disappear from Active Queries

Level 2 · node · Correctness · Incorrect interval membership across midnight

Scenario

A fictional observatory booking service stores recurring daily booking windows using integer hours from 0 through 23. A start hour greater than the end hour means the booking continues past midnight into the next morning. The current query requires an hour to be both at least the start and below the end, so a window from 22:00 to 03:00 never appears. Inspect the repository, service, and controller.

Requirements

Include the starting hour and exclude the ending hour while supporting windows that cross midnight. Preserve ordinary daytime windows, room isolation, empty results for unknown rooms, and rejection of invalid bookings. Do not add date libraries or network calls.

Acceptance criteria

  • An overnight booking appears at applicable hours before and after midnight.
  • A daytime booking appears only between its opening and closing hours.
  • The exact starting hour is included.
  • The exact ending hour is excluded.
  • An unknown observatory room returns an empty list.
  • An invalid booking interval is rejected without changing stored bookings.