4 ms·
From my experience it is a common mistake to do overlap comparisons of intervals this way. https://github.com/fmeringdal/nettu-scheduler/blob/df737e128a24bd8ce
by de6u99er 6y ago
From my experience it is a common mistake to do overlap comparisons of intervals this way.
https://github.com/fmeringdal/nettu-scheduler/blob/df737e128a24bd8ce48e66af7220044a889d7587/scheduler/crates/domain/src/event_instance.rs#L128 https://github.com/fmeringdal/nettu-scheduler/blob/df737e128...
IMO start time should be treated as inclusive, and end time as exclusive.
E.g. an event from 1pm-2pm does not overlap with an event starting at 2pm because it's end-time is defined as exclusive.
Therefore you need to replace one of you greater/lower-than's with a normal greater/lower comparison operator.
- fmeringdal 6y agoThanks for your feedback! I will look into it :)
- de6u99er 6y agoNo problem. Took me 2 min to find it. I actually searched for the term "overlap" to see if you're doing it correctly ;) At least you're using one if statement. Many do interval overlap comparisons with two if statements.
- fmeringdal 6y agoHaha! I must admit that I also did two if statements the first time I implemented overlaps ;)