Skip to content

Commit

Permalink
check that deadline is in the future, not in the past
Browse files Browse the repository at this point in the history
  • Loading branch information
SjoenH committed Apr 18, 2024
1 parent 91de8ee commit 3ef9b70
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public void AddBookingRequests([Required] IEnumerable<CreateBookingRequestDto> r
{
throw new Exception("One or more periods are not part of a draw");
}

var periodsWithCompletedDraw = periods.Where(p => p.Draw?.DeadlineEnd < DateTime.Now).ToList();
if (periodsWithCompletedDraw.Count != 0)
var periodsWithEndedDraw = periods.Where(p => p.Draw?.DeadlineEnd > DateTime.Now).ToList();
if (periodsWithEndedDraw.Count != 0)
{
throw new Exception("One or more draws are already completed");
throw new Exception("Cannot make a booking request for a draw that has ended");
}

var bookingRequestEntities = periodIds.Select(id => new BookingRequestEntity(currentUserId, id));
Expand Down

0 comments on commit 3ef9b70

Please sign in to comment.