fix: no availability on reschedule with load balancing (#17770)

* don't filter if reschedule with same host

* check for reschedule

* fix filtering in handleNewBooking

* fix type error

---------

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2024-11-21 01:22:43 +00:00
1 parent ade144aa20
commit 8bc2c08288
4 files changed
+24 -14

No files matched your search

@@ -477,6 +477,7 @@ async function handler(
logger: loggerWithEventDetails,
routedTeamMemberIds: routedTeamMemberIds ?? null,
contactOwnerEmail,
isSameHostReschedule: !!(eventType.rescheduleWithSameRoundRobinHost && reqBody.rescheduleUid),
});
// We filter out users but ensure allHostUsers remain same.
@@ -42,6 +42,7 @@ type InputProps = {
logger: Logger<unknown>;
routedTeamMemberIds: number[] | null;
contactOwnerEmail: string | null;
isSameHostReschedule: boolean;
};
export async function loadAndValidateUsers({
@@ -52,6 +53,7 @@ export async function loadAndValidateUsers({
logger,
routedTeamMemberIds,
contactOwnerEmail,
isSameHostReschedule,
}: InputProps): Promise<Users> {
let users: Users = await loadUsers({
eventType,
@@ -110,7 +112,7 @@ export async function loadAndValidateUsers({
email: host.user.email,
user: host.user,
})),
maxLeadThreshold: eventType.maxLeadThreshold,
maxLeadThreshold: isSameHostReschedule ? null : eventType.maxLeadThreshold,
});
if (qualifiedHosts.length) {
// remove users that are not in the qualified hosts array