Add overlapping constraint

This commit is contained in:
Lars Westermann 2019-06-11 15:17:12 +02:00
parent ce4e4635e3
commit e7bdaabca8
Signed by: lars.westermann
GPG key ID: 9D417FA5BB9D5E1D

View file

@ -56,6 +56,17 @@ fun checkConstraints(
}
}
for (s in against) {
if (
schedule != s &&
schedule.room.id == s.room.id &&
start < s.getAbsoluteEndTime() &&
s.getAbsoluteStartTime() < end
) {
errors += ConstraintError("Work group cannot be at same time with ${s.workGroup.name} at the same room ${schedule.room.name}!")
}
}
for ((type, constraints) in schedule.workGroup.constraints.groupBy { it.type }) {
when (type) {
ConstraintType.OnlyOnDay -> {