Skip to content

Commit

Permalink
Student Scheduling: Selected Enrollments
Browse files Browse the repository at this point in the history
- only return selected enrollments of the first course
  (the selected enrollments of the alternative course or courses do not take precedence over other enrollments of the first course)
- this fixes the issue of giving student an alternative course because of its preference when the Students.BranchWhenSelectedHasNoConflict is enabled
  (other enrollments of the request are ignored when there is a non-conflicting selected enrollment)
  • Loading branch information
tomas-muller committed Jun 13, 2018
1 parent 9693b2a commit 889ccf1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/org/cpsolver/studentsct/model/CourseRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public List<Enrollment> getAvaiableEnrollments(Assignment<Request, Enrollment> a
}

/**
* Return all enrollments that are selected (
* Return all enrollments of the first course that are selected (
* {@link CourseRequest#isSelected(Section)} is true)
*
* @param assignment current assignment
Expand All @@ -475,16 +475,15 @@ public List<Enrollment> getSelectedEnrollments(Assignment<Request, Enrollment> a
if (getSelectedChoices().isEmpty())
return null;
List<Enrollment> enrollments = new ArrayList<Enrollment>();
int idx = 0;
for (Course course : iCourses) {
boolean hasChoice = false;
for (Choice choice: getSelectedChoices())
if (course.getOffering().equals(choice.getOffering())) { hasChoice = true; break; }
if (hasChoice)
for (Config config : course.getOffering().getConfigs()) {
computeEnrollments(assignment, enrollments, idx, 0, course, config, new HashSet<Section>(), 0, availableOnly, false, true, false, -1);
computeEnrollments(assignment, enrollments, 0, 0, course, config, new HashSet<Section>(), 0, availableOnly, false, true, false, -1);
}
idx++;
break;
}
return enrollments;
}
Expand Down

0 comments on commit 889ccf1

Please sign in to comment.