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

Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
This commit is contained in:
Hariom Balhara
2024-09-02 16:12:11 +05:30
committed by GitHub
co-authored by Udit Takkar
parent 971d9ff0d8
commit 5d8ed130de
+19 -17
View File
@@ -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 } = {};