fix: Slots are available even after exceeding the booking limits for the team event (#21801)
* fix: slots available * fix type error * update * update
This commit is contained in:
1 parent
e160a4add0
commit
601df7f808
2 files changed
+14
-14
No files matched your search
@@ -30,7 +30,7 @@ import { parseBookingLimit } from "@calcom/lib/intervalLimits/isBookingLimits";
|
||||
import { parseDurationLimit } from "@calcom/lib/intervalLimits/isDurationLimits";
|
||||
import LimitManager from "@calcom/lib/intervalLimits/limitManager";
|
||||
import { checkBookingLimit } from "@calcom/lib/intervalLimits/server/checkBookingLimits";
|
||||
import { getUnitFromBusyTime, isBookingWithinPeriod } from "@calcom/lib/intervalLimits/utils";
|
||||
import { isBookingWithinPeriod } from "@calcom/lib/intervalLimits/utils";
|
||||
import {
|
||||
calculatePeriodLimits,
|
||||
isTimeOutOfBounds,
|
||||
@@ -1031,13 +1031,7 @@ const _getBusyTimesFromLimitsForUsers = async (
|
||||
const userBookings = busyTimesFromLimitsBookings.filter((booking) => booking.userId === user.id);
|
||||
const limitManager = new LimitManager();
|
||||
|
||||
for (const busyTime of globalLimitManager.getBusyTimes()) {
|
||||
const start = dayjs(busyTime.start);
|
||||
const end = dayjs(busyTime.end);
|
||||
const unit = getUnitFromBusyTime(start, end);
|
||||
|
||||
limitManager.addBusyTime(start, unit, timeZone);
|
||||
}
|
||||
limitManager.mergeBusyTimes(globalLimitManager);
|
||||
|
||||
if (bookingLimits) {
|
||||
for (const key of descendingLimitKeys) {
|
||||
@@ -1222,13 +1216,8 @@ const _getBusyTimesFromTeamLimitsForUsers = async (
|
||||
const userBusyTimes = busyTimes.filter((busyTime) => busyTime.userId === user.id);
|
||||
const limitManager = new LimitManager();
|
||||
|
||||
for (const busyTime of globalLimitManager.getBusyTimes()) {
|
||||
const start = dayjs(busyTime.start);
|
||||
const end = dayjs(busyTime.end);
|
||||
const unit = getUnitFromBusyTime(start, end);
|
||||
limitManager.mergeBusyTimes(globalLimitManager);
|
||||
|
||||
limitManager.addBusyTime(start, unit, timeZone);
|
||||
}
|
||||
const bookingLimitsParams = {
|
||||
bookings: userBusyTimes,
|
||||
bookingLimits,
|
||||
|
||||
Reference in new issue
Block a user