Skip to content

Commit

Permalink
Online Student Scheduling: Suggestions
Browse files Browse the repository at this point in the history
- consider order of the courses within a course request when comparing two suggestions
  • Loading branch information
tomas-muller committed Oct 30, 2019
1 parent 67338fe commit ef53256
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ public class Suggestion implements Comparable<Suggestion> {
private Section iSelectedEnrollment = null;
private boolean iSelectedEnrollmentChangeTime = false;
private TreeSet<Section> iSelectedSections = new TreeSet<Section>(new EnrollmentSectionComparator());
private int iSelectedChoice = 0;

/**
* Create suggestion
Expand Down Expand Up @@ -657,8 +658,10 @@ public Suggestion(ArrayList<Request> resolvedRequests) {
if (iSelectedRequest != null) {
Enrollment enrollment = iAssignment.getValue(iSelectedRequest);
if (enrollment.isCourseRequest() && enrollment.getAssignments() != null
&& !enrollment.getAssignments().isEmpty())
&& !enrollment.getAssignments().isEmpty()) {
iSelectedSections.addAll(enrollment.getSections());
iSelectedChoice = ((CourseRequest)iSelectedRequest).getCourses().indexOf(enrollment.getCourse());
}
}
}

Expand Down Expand Up @@ -773,6 +776,10 @@ public int compareTo(Suggestion suggestion) {
cmp = Double.compare(getNrChanges(), suggestion.getNrChanges());
if (cmp != 0)
return cmp;

cmp = Double.compare(iSelectedChoice, suggestion.iSelectedChoice);
if (cmp != 0)
return cmp;

Iterator<Section> i1 = iSelectedSections.iterator();
Iterator<Section> i2 = suggestion.iSelectedSections.iterator();
Expand Down

0 comments on commit ef53256

Please sign in to comment.