Update constraint checking
This commit is contained in:
parent
f417764695
commit
3187f472fc
|
@ -40,6 +40,21 @@ fun checkConstraints(
|
|||
errors += ConstraintError("Work group requires accessible, but room does not have one!")
|
||||
}
|
||||
|
||||
val start = schedule.getAbsoluteStartTime()
|
||||
val end = schedule.getAbsoluteEndTime()
|
||||
|
||||
for (leader in schedule.workGroup.leader) {
|
||||
for (s in against) {
|
||||
if (
|
||||
leader in s.workGroup.leader &&
|
||||
start <= s.getAbsoluteEndTime() &&
|
||||
s.getAbsoluteStartTime() <= end
|
||||
) {
|
||||
errors += ConstraintError("Work group with leader $leader cannot be at same time with ${s.workGroup.name}!")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ((type, constraints) in schedule.workGroup.constraints.groupBy { it.type }) {
|
||||
when (type) {
|
||||
ConstraintType.OnlyOnDay -> {
|
||||
|
@ -89,8 +104,6 @@ fun checkConstraints(
|
|||
}
|
||||
|
||||
ConstraintType.NotAtSameTime -> {
|
||||
val start = schedule.getAbsoluteStartTime()
|
||||
val end = schedule.getAbsoluteEndTime()
|
||||
for (constraint in constraints) {
|
||||
for (s in against) {
|
||||
if (
|
||||
|
@ -105,7 +118,6 @@ fun checkConstraints(
|
|||
}
|
||||
|
||||
ConstraintType.OnlyAfterWorkGroup -> {
|
||||
val start = schedule.getAbsoluteStartTime()
|
||||
for (constraint in constraints) {
|
||||
for (s in against) {
|
||||
if (
|
||||
|
|
Loading…
Reference in a new issue