Skip to content

Scheduling infrastructure for absolutely everyone.

Fix unconfirmed bookings blocking slots being fetched for all troubleshooters (#16439)

Hariom Balhara5d8ed130de7a
diff --git a/packages/core/getBusyTimes.ts b/packages/core/getBusyTimes.ts
index 263ff90252d..a4f479a7669 100644
--- a/packages/core/getBusyTimes.ts
+++ b/packages/core/getBusyTimes.ts
@@ -155,29 +155,31 @@ export async function getBusyTimes(params: {
select: bookingsSelect,
});
- const currentBookingsAllUsersQueryThree = prisma.booking.findMany({
- where: {
- startTime: { lte: endTimeDate },
- endTime: { gte: startTimeDate },
- eventType: {
- id: eventTypeId,
- requiresConfirmation: true,
- requiresConfirmationWillBlockSlot: true,
- },
- status: {
- in: [BookingStatus.PENDING],
- },
- },
- select: bookingsSelect,
- });
+ const unconfirmedBookingsBlockingSlots = eventTypeId
+ ? prisma.booking.findMany({
+ where: {
+ startTime: { lte: endTimeDate },
+ endTime: { gte: startTimeDate },
+ eventType: {
+ id: eventTypeId,
+ requiresConfirmation: true,
+ requiresConfirmationWillBlockSlot: true,
+ },
+ status: {
+ in: [BookingStatus.PENDING],
+ },
+ },
+ select: bookingsSelect,
+ })
+ : null;
const [resultOne, resultTwo, resultThree] = await Promise.all([
currentBookingsAllUsersQueryOne,
currentBookingsAllUsersQueryTwo,
- currentBookingsAllUsersQueryThree,
+ unconfirmedBookingsBlockingSlots,
]);
- bookings = [...resultOne, ...resultTwo, ...resultThree];
+ bookings = [...resultOne, ...resultTwo, ...(resultThree ?? [])];
}
const bookingSeatCountMap: { [x: string]: number } = {};