fix: eventtype null cant be booked error#18975
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
| if (isAfterRollingEndDay) | ||
| log.warn("Booking is out of bounds due to rolling period end day.", { | ||
| formattedDate: dateInSystemTz.format(), | ||
| isAfterRollingEndDay, | ||
| endOfRollingPeriodEndDayInBookerTz: periodLimits.endOfRollingPeriodEndDayInBookerTz.format(), | ||
| }); |
There was a problem hiding this comment.
Add detailed logs when booking fails due to attempted booking after the rolling period
| if (isBeforeRangeStart || isAfterRangeEnd) | ||
| log.warn("Booking is out of bounds due to range start and end.", { | ||
| formattedDate: dateInSystemTz.format(), | ||
| isBeforeRangeStart, | ||
| isAfterRangeEnd, | ||
| startOfRangeStartDayInEventTz: periodLimits.startOfRangeStartDayInEventTz.format(), | ||
| endOfRangeEndDayInEventTz: periodLimits.endOfRangeEndDayInEventTz.format(), | ||
| }); |
There was a problem hiding this comment.
Add detailed logs when booking fails due to attempted booking outside of period Range
| ): { isOutOfBounds: boolean; cause: string | null } { | ||
| const isOutOfBoundsByTime = isTimeOutOfBounds({ time, minimumBookingNotice }); | ||
| const periodLimits = calculatePeriodLimits({ | ||
| periodType, | ||
| periodDays, | ||
| periodCountCalendarDays, | ||
| periodStartDate, | ||
| periodEndDate, | ||
| allDatesWithBookabilityStatusInBookerTz: null, // Temporary workaround | ||
| _skipRollingWindowCheck: true, | ||
| eventUtcOffset, | ||
| bookerUtcOffset, | ||
| }); | ||
|
|
||
| const isOutOfBoundsByPeriod = isTimeViolatingFutureLimit({ | ||
| time, | ||
| periodLimits, | ||
| }); | ||
|
|
||
| if (isOutOfBoundsByTime) | ||
| return { | ||
| isOutOfBounds: true, | ||
| cause: "Booking is out of bounds due to minimum booking notice.", | ||
| }; | ||
|
|
||
| if (isOutOfBoundsByPeriod) { | ||
| log.warn(`Booking is out of bounds due to period restrictions - ${periodLimits}`); | ||
| return { | ||
| isOutOfBounds: true, | ||
| cause: "Booking is out of bounds due to period restrictions.", | ||
| }; | ||
| } | ||
|
|
||
| return { | ||
| isOutOfBounds: false, | ||
| cause: null, | ||
| }; |
There was a problem hiding this comment.
Return cause along with isOutOfBounds to have a distinct reason on why a booking failed
|
|
||
| logger.warn({ | ||
| message: `NewBooking: EventType '${eventType.eventName}' cannot be booked at this time.`, | ||
| message: `NewBooking: EventType '${eventType.title}' cannot be booked at this time. Reason: ${cause}`, |
There was a problem hiding this comment.
We also add cause here to have a clearer picture of what the cause of this failure is.
| log.warn( | ||
| "Booking is out of bounds due to rolling period end day.", | ||
| safeStringify({ | ||
| formattedDate: dateInSystemTz.format(), | ||
| isAfterRollingEndDay, | ||
| endOfRollingPeriodEndDayInBookerTz: periodLimits.endOfRollingPeriodEndDayInBookerTz.format(), | ||
| }) | ||
| ); |
There was a problem hiding this comment.
We log all necessary details when user attempts to book after the rolling period
| log.warn( | ||
| "Booking is out of bounds due to range start and end.", | ||
| safeStringify({ | ||
| formattedDate: dateInSystemTz.format(), | ||
| isBeforeRangeStart, | ||
| isAfterRangeEnd, | ||
| startOfRangeStartDayInEventTz: periodLimits.startOfRangeStartDayInEventTz.format(), | ||
| endOfRangeEndDayInEventTz: periodLimits.endOfRangeEndDayInEventTz.format(), | ||
| }) | ||
| ); |
There was a problem hiding this comment.
We log all necessary details when user attempts to book outside the period range
Graphite Automations"Add ready-for-e2e label" took an action on this PR • (01/29/25)1 label was added to this PR based on Keith Williams's automation. |
E2E results are ready! |
* fix err msg and add more description * improvements * fix cause * add warn logs for when failing to specific limit checks * typefix * safestringify log * improve error * test fix and log min booking notice * adds out of bounds error code * test fix * fix
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
* fix err msg and add more description * improvements * fix cause * add warn logs for when failing to specific limit checks * typefix * safestringify log * improve error * test fix and log min booking notice * adds out of bounds error code * test fix * fix
What does this PR do?
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Checklist