Open eleidan opened 8 years ago
The VacationRequest#cannot_intersect_with_other_vacations can be implemented in more simple way, as follows:
VacationRequest#cannot_intersect_with_other_vacations
(start_date - another.end_date) * (another.start_date - end_date) >= 0
But in SQL :wink:
In postgres you can do it like this: ... where daterange(DATE '<user1_start_date>', DATE '<user1_end_date>') && daterange(DATE '<user2_start_date>', DATE '<user2_end_date>')
where daterange(DATE '<user1_start_date>', DATE '<user1_end_date>') && daterange(DATE '<user2_start_date>', DATE '<user2_end_date>')
The
VacationRequest#cannot_intersect_with_other_vacations
can be implemented in more simple way, as follows:But in SQL :wink: