Commit a8ff21a1 authored by PabloLeCrapaud's avatar PabloLeCrapaud
Browse files

Merge branch 'public-dev' into dev

parents f475a99e 76f070b3
......@@ -275,15 +275,15 @@ class ConsiderPivots(TTConstraint):
all_after = ttmodel.add_floor(ttmodel.sum(ttmodel.TT[(sl2, o)]
for o in other
for sl2 in ttmodel.wdb.compatible_slots[o]
if not sl2.is_after(sl1)
or (p.ND and (sl2.day == sl1.day))
if (not p.ND and not sl2.is_after(sl1))
or (p.ND and (sl1.has_previous_day_than(sl2)))
),
other_length, 2 * other_length)
all_before = ttmodel.add_floor(ttmodel.sum(ttmodel.TT[(sl2, o)]
for o in other
for sl2 in ttmodel.wdb.compatible_slots[o]
if not sl1.is_after(sl2)
or (p.ND and (sl2.day == sl1.day))
if (not p.ND and not sl1.is_after(sl2))
or (p.ND and (sl2.has_previous_day_than(sl1)))
),
other_length, 2 * other_length)
if not self.weight:
......
......@@ -66,10 +66,10 @@ class Slot:
def has_previous_day_than(self, other):
if type(other) == type(self):
return self.day.week > other.day.week \
or self.day.week == other.day.week and days_index[self.day.day] > days_index[other.day.day]
or self.day.week == other.day.week and days_index[self.day.day] < days_index[other.day.day]
elif type(other) == ScheduledCourse:
return self.day.week > other.course.week \
or self.day.week == other.course.week and days_index[self.day.day] > days_index[other.day]
or self.day.week == other.course.week and days_index[self.day.day] < days_index[other.day]
else:
raise TypeError("A slot can only have previous day than a ScheduledCourse or another slot")
......@@ -80,7 +80,7 @@ class Slot:
return False
def is_after(self, other):
if self.has_previous_day_than(other) or self.has_same_day(other) and self.start_time >= other.end_time:
if other.has_previous_day_than(self) or self.has_same_day(other) and self.start_time >= other.end_time:
return True
else:
return False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment