-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Multiple rr-hosts combine to create erroneous availability #18772
base: main
Are you sure you want to change the base?
fix: Multiple rr-hosts combine to create erroneous availability #18772
Conversation
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details:
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
…t returns the same slots twice.
expect(result).toHaveLength(6); | ||
}); | ||
|
||
it("can merge multiple time slot groups when multiple date ranges are given that overlap", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overlapping time slots weren't possible before as date ranges were merged, even rr hosts. Now they are possible because different rr hosts may have overlapping date ranges but we still want to handle individually.
@@ -233,12 +237,12 @@ function buildSlotsWithDateRanges({ | |||
}; | |||
} | |||
|
|||
slots.push(slotData); | |||
slots.set(slotData.time.toISOString(), slotData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Key based on start time (same as rendering in Booker)
}, | ||
// 12:00-12:20,12:20-12:40 | ||
{ | ||
start: nextDay.hour(11).minute(20), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this resulted in 7 slots, due to 11:20/11:40 overlap with dateRanges[0]. This is now corrected to the correct (5)
… to reproduce this
Graphite Automations"Add foundation team as reviewer" took an action on this PR • (01/22/25)1 reviewer was added to this PR based on Keith Williams's automation. |
What does this PR do?
Fixes situation where overlapping date ranges from multiple rr hosts "merge" and result in a bigger sized slot than intended. Each date range needs to stay intact to generate the slot.
The slot logic also needed to be modified as now slots would be generated for each individual date range to prevent the following situation:
(host A 11:00-13:00, host B 11:15-13:00, frequency=45)
With new changes to the slot logic, the slots are consistent with previous behaviour: