change the logic of clipping leases
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 7 Feb 2024 11:12:04 +0000 (12:12 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 7 Feb 2024 11:12:04 +0000 (12:12 +0100)
there was a mishap when clipping, that was returning adjacent leases

PLC/LeaseFilter.py

index 4ed6c01..de340ea 100644 (file)
@@ -64,10 +64,10 @@ class LeaseFilter(Filter):
     # basic SQL utilities
     @staticmethod
     def sql_time_intersect(f1, u1, f2, u2):
-        # either f2 is in [f1,u1], or u2 is in [f1,u1], or f2<=f1<=u1<=u2
+        # either f2 is in [f1,u1[, or u2 is in ]f1,u1], or f2<=f1<u1<=u2
         return (
-            f"(({f1} <= {f2}) AND ({f2} <= {u1})) "
-            f"OR (({f1} <= {u2}) AND ({u2} <= {u1})) "
+            f"(({f1} <= {f2}) AND ({f2} < {u1})) "
+            f"OR (({f1} < {u2}) AND ({u2} <= {u1})) "
             f"OR (({f2}<={f1}) AND ({u1}<={u2}))")
 
     @staticmethod