Reservation System

Reservation System

Here is my basic code to start with.

// Step 1: Capture user input for Check-In and Check-Out dates
check_in_date = toDate(check_in,"MM-dd-yyyy");
check_out_date = toDate(check_in,"MM-dd-yyyy");
//info "Check in date " + check_in_date + " - Check out date " + check_out_date;
// Step 2: Get a list of all nightly rentals I only have 68 rentals
all_rentals = Sites[Campsites == true];
//info "All Rentals " + Sites[Campsites == true].count();
// Step 3: Filter rentals that are not booked for the requested date range
available_rentals = Collection();
// Create an empty collection to store available rentals
for each  rental in all_rentals
{
// Check for existing reservations in the "Reservations" table
reservations = CG_Reservation[Sites == rental && Active_Reservation == true && Check_In != null && Last_Night != null && Check_In <= check_out_date && Last_Night >= check_in_date];
// If no reservations conflict with the requested dates, add the rental to available_rentals
if(reservations.ID == null)
{
available_rentals.insert(rental.ID);
}
}

When I execute the code with these dates, 09-25-2024 Check-in and 10-01-2024 Check-out. It's returning 37 available. The correct answer would be 14
How do I remove the 23 that's incorrect
It's returning Rental 2B  Which is already rented 09-27-2024 to 09-29-2024 

Any suggestions