Skip to content

Commit

Permalink
don't auto approve any event > 4hrs
Browse files Browse the repository at this point in the history
  • Loading branch information
lucia-gomez committed Apr 12, 2024
1 parent 7d05278 commit a3722bc
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,12 @@ export default function useSubmitBooking(): [
]);

const isAutoApproval = (selectedRoomIds: string[], data: Booking) => {
const startDate = new Date(data.startDate);
const endDate = new Date(data.endDate);
const duration = endDate.getTime() - startDate.getTime();
// If the selected rooms are all instant approval rooms and the user does not need catering, and hire security, and room setup, then it is auto-approval.
return (
duration <= 3.6e6 * 4 && // <= 4 hours
selectedRoomIds.every((r) => INSTANT_APPROVAL_ROOMS.includes(r)) &&
data['catering'] === 'no' &&
data['hireSecurity'] === 'no' &&
Expand Down

0 comments on commit a3722bc

Please sign in to comment.