fix(availability): don't offer round-robin slots when a mandatory fixed host is unavailable#29797
Open
shafi-VM wants to merge 1 commit into
Open
fix(availability): don't offer round-robin slots when a mandatory fixed host is unavailable#29797shafi-VM wants to merge 1 commit into
shafi-VM wants to merge 1 commit into
Conversation
…ed host is unavailable getAggregatedAvailability dropped the fixed-host constraint whenever the fixed hosts' intersection was empty — but that is empty in two different cases: (a) there are no fixed hosts, and (b) fixed hosts exist but can't overlap (a mandatory host is busy). The `fixedDateRanges.length ? [fixedDateRanges] : []` check conflated them, so for a ROUND_ROBIN event with a busy fixed host the aggregate was driven by the round-robin hosts alone, leaking bookable slots the booking layer then rejects (FixedHostsUnavailableForBooking). Gate on `fixedHosts.length` instead, so an empty fixed-host intersection forces the aggregate empty. Adds a regression test; existing availability/schedules tests (213) unaffected.
Contributor
|
Welcome to Cal.diy, @shafi-VM! Thanks for opening this pull request. A few things to keep in mind:
A maintainer will review your PR soon. Thanks for contributing! |
shafi-VM
marked this pull request as ready for review
July 18, 2026 13:51
Contributor
📝 WalkthroughWalkthroughUpdated 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #29800
getAggregatedAvailabilitydropped the fixed-host constraint whenever the fixed hosts' intersection was empty — but that's empty both when there are no fixed hosts and when fixed hosts exist but can't overlap (a mandatory host is busy).fixedDateRanges.length ? [fixedDateRanges] : []conflated them, so a ROUND_ROBIN event with a busy fixed host leaked slots driven by the round-robin hosts alone — slots the booking layer then rejects withFixedHostsUnavailableForBooking. Gating onfixedHosts.lengthinstead forces an empty fixed-host intersection to make the aggregate empty.Visual Demo (For contributors especially)
Backend logic fix with no UI surface — demonstrated with a red→green unit test rather than a recording (see How should this be tested?).
Video Demo (if applicable):
N/A — no UI change.
Image Demo (if applicable):
N/A — no UI change.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
FixedHostsUnavailableForBooking).getAggregatedAvailability.test.tsasserts aROUND_ROBINinput with a busy fixed host + an available round-robin host returns[]— verified red before the fix, green after; the other 10 tests in the file and the broader availability/schedules suites (213 tests) are unaffected.Checklist