perf: Improved buildDateRanges performance + cleanup (#10610)
Co-authored-by: Carina Wollendorfer <[email protected]>
This commit is contained in:
1 parent
6b536030fa
commit
e5f15cb1df
3 files changed
+2
-17
No files matched your search
@@ -1,7 +1,6 @@
|
||||
import { countBy } from "lodash";
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
import { getAggregateWorkingHours } from "@calcom/core/getAggregateWorkingHours";
|
||||
import { getAggregatedAvailability } from "@calcom/core/getAggregatedAvailability";
|
||||
import type { CurrentSeats } from "@calcom/core/getUserAvailability";
|
||||
import { getUserAvailability } from "@calcom/core/getUserAvailability";
|
||||
@@ -229,8 +228,6 @@ export async function getAvailableSlots(input: TGetScheduleInputSchema) {
|
||||
usersWithCredentials.map(async (currentUser) => {
|
||||
const {
|
||||
busy,
|
||||
workingHours,
|
||||
dateOverrides,
|
||||
dateRanges,
|
||||
currentSeats: _currentSeats,
|
||||
timeZone,
|
||||
@@ -254,8 +251,6 @@ export async function getAvailableSlots(input: TGetScheduleInputSchema) {
|
||||
if (!currentSeats && _currentSeats) currentSeats = _currentSeats;
|
||||
return {
|
||||
timeZone,
|
||||
workingHours,
|
||||
dateOverrides,
|
||||
dateRanges,
|
||||
busy,
|
||||
user: currentUser,
|
||||
@@ -263,11 +258,6 @@ export async function getAvailableSlots(input: TGetScheduleInputSchema) {
|
||||
})
|
||||
);
|
||||
|
||||
// flattens availability of multiple users
|
||||
const dateOverrides = userAvailability.flatMap((availability) =>
|
||||
availability.dateOverrides.map((override) => ({ userId: availability.user.id, ...override }))
|
||||
);
|
||||
const workingHours = getAggregateWorkingHours(userAvailability, eventType.schedulingType);
|
||||
const availabilityCheckProps = {
|
||||
eventLength: input.duration || eventType.length,
|
||||
currentSeats,
|
||||
@@ -290,8 +280,6 @@ export async function getAvailableSlots(input: TGetScheduleInputSchema) {
|
||||
const timeSlots = getSlots({
|
||||
inviteeDate: startTime,
|
||||
eventLength: input.duration || eventType.length,
|
||||
workingHours,
|
||||
dateOverrides,
|
||||
offsetStart: eventType.offsetStart,
|
||||
dateRanges: getAggregatedAvailability(userAvailability, eventType.schedulingType),
|
||||
minimumBookingNotice: eventType.minimumBookingNotice,
|
||||
|
||||
Reference in new issue
Block a user