This commit is contained in:
Anik Dhabal Babu
2024-11-11 09:37:14 +00:00
committed by GitHub
parent 62aaba32cf
commit 42a264380a
@@ -466,7 +466,6 @@ async function _getAvailableSlots({ input, ctx }: GetScheduleOptions): Promise<I
if (!startTime.isValid() || !endTime.isValid()) {
throw new TRPCError({ message: "Invalid time range given.", code: "BAD_REQUEST" });
}
let currentSeats: CurrentSeats | undefined;
const eventHosts: {
isFixed: boolean;
@@ -497,7 +496,7 @@ async function _getAvailableSlots({ input, ctx }: GetScheduleOptions): Promise<I
contactOwnerEmail,
});
let { aggregatedAvailability, allUsersAvailability, usersWithCredentials } =
let { aggregatedAvailability, allUsersAvailability, usersWithCredentials, currentSeats } =
await calculateHostsAndAvailabilities({
input,
eventType,
@@ -506,7 +505,6 @@ async function _getAvailableSlots({ input, ctx }: GetScheduleOptions): Promise<I
loggerWithEventDetails,
startTime,
endTime,
currentSeats,
bypassBusyCalendarTimes,
});
@@ -522,7 +520,7 @@ async function _getAvailableSlots({ input, ctx }: GetScheduleOptions): Promise<I
if (routedHostsAndFixedHosts.length > 0) {
// if the first available slot is more than 2 weeks from now, round robin as normal
({ aggregatedAvailability, allUsersAvailability, usersWithCredentials } =
({ aggregatedAvailability, allUsersAvailability, usersWithCredentials, currentSeats } =
await calculateHostsAndAvailabilities({
input,
eventType,
@@ -531,7 +529,6 @@ async function _getAvailableSlots({ input, ctx }: GetScheduleOptions): Promise<I
loggerWithEventDetails,
startTime,
endTime,
currentSeats,
bypassBusyCalendarTimes,
}));
}
@@ -1016,7 +1013,6 @@ const calculateHostsAndAvailabilities = async ({
loggerWithEventDetails,
startTime,
endTime,
currentSeats,
bypassBusyCalendarTimes,
}: {
input: TGetScheduleInputSchema;
@@ -1029,7 +1025,6 @@ const calculateHostsAndAvailabilities = async ({
loggerWithEventDetails: Logger<unknown>;
startTime: ReturnType<typeof getStartTime>;
endTime: Dayjs;
currentSeats?: CurrentSeats | undefined;
bypassBusyCalendarTimes: boolean;
}) => {
if (
@@ -1063,6 +1058,7 @@ const calculateHostsAndAvailabilities = async ({
});
const durationToUse = input.duration || 0;
let currentSeats: CurrentSeats | undefined;
const startTimeDate =
input.rescheduleUid && durationToUse
@@ -1175,5 +1171,5 @@ const calculateHostsAndAvailabilities = async ({
eventType.schedulingType
);
return { aggregatedAvailability, allUsersAvailability, usersWithCredentials };
return { aggregatedAvailability, allUsersAvailability, usersWithCredentials, currentSeats };
};