From de8e6dac29f0e9bf976a81167d6bfbd9f0a347c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAlexander?= Date: Fri, 9 Jun 2023 16:21:23 +0200 Subject: [PATCH] :bug: Fix Denied bookings causing conflict warning --- frontend/components/BookingTable/bookingTableRow.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/components/BookingTable/bookingTableRow.tsx b/frontend/components/BookingTable/bookingTableRow.tsx index 49f275330..8b3e11248 100644 --- a/frontend/components/BookingTable/bookingTableRow.tsx +++ b/frontend/components/BookingTable/bookingTableRow.tsx @@ -30,10 +30,14 @@ const getStatusColor = (bookingRequest: BookingRequest, otherBookingRequests: Bo && start < DateTime.fromISO(br.end) && br.what.some((ba) => bookingRequest.what.map((ba2) => ba2.id).includes(ba.id))); if (conflict) { - if (bookingRequest.status === BookingStatus.Pending) { + if (otherBookingRequests.some((br) => + br.status === BookingStatus.Accepted) + && bookingRequest.status !== BookingStatus.Denied) { return 'error'; } - if (bookingRequest.status === BookingStatus.Accepted) { + if (otherBookingRequests.some((br) => + br.status === BookingStatus.Pending) + && bookingRequest.status !== BookingStatus.Denied) { return 'warning'; } }