Revert "fix: weekly limits (#10404)"

This reverts commit 1d5b383529.
pull/10544/head
Alex van Andel 2023-08-02 16:15:32 +01:00
parent 02c5aa02df
commit 83678dfea2
1 changed files with 3 additions and 5 deletions

View File

@ -42,7 +42,6 @@ const getEventType = async (id: number) => {
bookingLimits: true, bookingLimits: true,
durationLimits: true, durationLimits: true,
timeZone: true, timeZone: true,
length: true,
metadata: true, metadata: true,
schedule: { schedule: {
select: { select: {
@ -166,9 +165,8 @@ export async function getUserAvailability(
const busyTimes = await getBusyTimes({ const busyTimes = await getBusyTimes({
credentials: user.credentials, credentials: user.credentials,
// needed to correctly apply limits (weeks can be part of two months) startTime: dateFrom.toISOString(),
startTime: dateFrom.startOf("week").toISOString(), endTime: dateTo.toISOString(),
endTime: dateTo.endOf("week").toISOString(),
eventTypeId, eventTypeId,
userId: user.id, userId: user.id,
username: `${user.username}`, username: `${user.username}`,
@ -376,7 +374,7 @@ const getBusyTimesFromDurationLimits = async (
// loop through all dates and check if we have reached the limit // loop through all dates and check if we have reached the limit
for (const date of dates) { for (const date of dates) {
let total = (duration || eventType?.length) ?? 0; let total = duration ?? 0;
const startDate = date.startOf(filter); const startDate = date.startOf(filter);
const endDate = date.endOf(filter); const endDate = date.endOf(filter);