Efficient algorithm to check dates overlap – Rails Guides

Picture this. A real estate site’s guest wants to book a hotel for specific dates. The system should check whether these dates are available, i.e. if they are not overlapping with some other existing booking. Let’s say, software engineers have written this hypothetical site in Rails and have come up with Booking model. It represents bookings table with two columns: start_date and end_date of date type. Also suppose, there is a validation somewhere checking start_date <= end_date. The solution below describes how to cope with this specific situation. Similar data models can follow it, though.
Efficient algorithm to check dates overlap – Rails Guides #ruby #rubydeveloper #rubyonrails #guides https://rubyonrails.ba/single/efficient-algorithm-to-check-dates-overlap-rails-guides

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles