Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

Commit

Permalink
🐛 Fix Denied bookings causing conflict warning
Browse files Browse the repository at this point in the history
  • Loading branch information
p1173x committed Oct 4, 2023
1 parent 1bd70d1 commit de8e6da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/components/BookingTable/bookingTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}
Expand Down

0 comments on commit de8e6da

Please sign in to comment.