fix: use selected duration when checking for conflicts for new bookings (#10713)

chore/add-otel-new^2
dihedral 2023-09-14 16:40:49 +02:00 committed by GitHub
parent d65f0ee0e8
commit add297b09a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -367,6 +367,7 @@ async function ensureAvailableUsers(
}
) {
const availableUsers: IsFixedAwareUser[] = [];
const duration = dayjs(input.dateTo).diff(input.dateFrom, 'minute');
const originalBookingDuration = input.originalRescheduledBooking
? dayjs(input.originalRescheduledBooking.endTime).diff(
@ -411,10 +412,10 @@ async function ensureAvailableUsers(
// running at the first unavailable time.
let i = 0;
while (!foundConflict && i < allBookingDates.length) {
foundConflict = checkForConflicts(bufferedBusyTimes, allBookingDates[i++], eventType.length);
foundConflict = checkForConflicts(bufferedBusyTimes, allBookingDates[i++], duration);
}
} else {
foundConflict = checkForConflicts(bufferedBusyTimes, input.dateFrom, eventType.length);
foundConflict = checkForConflicts(bufferedBusyTimes, input.dateFrom, duration);
}
} catch {
log.debug({