fix: Multiple rr-hosts combine to create erroneous availability (#18772)
* wip: Open draft PR with passing test (should fail) * Fix aggregatedAvailability by not merging rr host availability * Added test for validating fixed host behaviour * Add test for combined rr and fixed hosts * Check date-ranges arent returned multiple times when offered by multiple rr hosts * Also sort date ranges * Adding failing test that should result in 5 slots, but returns 7 as it returns the same slots twice. * Slots returns duplicate slots for overlapping date ranges * As mergeOverlappingDateRanges enabled the unified start time, we need to reproduce this * Do not 'prettify' slots to the same degree if they fall on different days * Added test to prove an end date before start also works * Use a string instead of number as key * chore: Deprecate organizerTimeZone, effectively unused * Adjust all dateRanges similarly * Bring back eventTimeZone * Remove adjustDateRanges in favour of slot generation changes * Convert to tz after all logic is finished. * clearer code flow * Remove console.log + add failing test due to inverse order * Address issue with inversion when date ranges are given out of order
This commit is contained in:
1 parent
4fd31db6ee
commit
f5dc22f145
5 files changed
+544
-169
No files matched your search
@@ -396,11 +396,6 @@ async function _getAvailableSlots({ input, ctx }: GetScheduleOptions): Promise<I
|
||||
eventType.schedulingType === SchedulingType.ROUND_ROBIN ||
|
||||
allUsersAvailability.length > 1;
|
||||
|
||||
// timeZone isn't directly set on eventType now(So, it is legacy)
|
||||
// schedule is always expected to be set for an eventType now so it must never fallback to allUsersAvailability[0].timeZone(fallback is again legacy behavior)
|
||||
// TODO: Also, handleNewBooking only seems to be using eventType?.schedule?.timeZone which seems to confirm that we should simplify it as well.
|
||||
const eventTimeZone =
|
||||
eventType.timeZone || eventType?.schedule?.timeZone || allUsersAvailability?.[0]?.timeZone;
|
||||
const timeSlots = monitorCallbackSync(getSlots, {
|
||||
inviteeDate: startTime,
|
||||
eventLength: input.duration || eventType.length,
|
||||
@@ -408,7 +403,6 @@ async function _getAvailableSlots({ input, ctx }: GetScheduleOptions): Promise<I
|
||||
dateRanges: aggregatedAvailability,
|
||||
minimumBookingNotice: eventType.minimumBookingNotice,
|
||||
frequency: eventType.slotInterval || input.duration || eventType.length,
|
||||
organizerTimeZone: eventTimeZone,
|
||||
datesOutOfOffice: !isTeamEvent ? allUsersAvailability[0]?.datesOutOfOffice : undefined,
|
||||
});
|
||||
|
||||
@@ -554,6 +548,9 @@ async function _getAvailableSlots({ input, ctx }: GetScheduleOptions): Promise<I
|
||||
const allDatesWithBookabilityStatus = monitorCallbackSync(getAllDatesWithBookabilityStatus, availableDates);
|
||||
loggerWithEventDetails.debug(safeStringify({ availableDates }));
|
||||
|
||||
const eventTimeZone =
|
||||
eventType.timeZone || eventType?.schedule?.timeZone || allUsersAvailability?.[0]?.timeZone;
|
||||
|
||||
const eventUtcOffset = getUTCOffsetByTimezone(eventTimeZone) ?? 0;
|
||||
const bookerUtcOffset = input.timeZone ? getUTCOffsetByTimezone(input.timeZone) ?? 0 : 0;
|
||||
const periodLimits = calculatePeriodLimits({
|
||||
|
||||
Reference in new issue
Block a user