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:
co-authored by
Udit Takkar
parent
971d9ff0d8
commit
5d8ed130de
@@ -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 } = {};
|
||||
|
||||
Reference in New Issue
Block a user