Skip to content

Commit bff4cf6

Browse files
committed
Student Scheduling Solver Dashboard: Dependent Courses
- show the "Not-assigned associated course {0}." message when applicable while showing student details (List of Classes) (set the dependent course relations to allow for correct evaluation of the condition)
1 parent c36a5b2 commit bff4cf6

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

JavaSource/org/unitime/timetable/onlinesectioning/basic/GetAssignment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@ public int compare(Enrollment o1, Enrollment o2) {
756756
Hashtable<CourseRequest, TreeSet<Section>> overlapingSections = new Hashtable<CourseRequest, TreeSet<Section>>();
757757
Assignment<Request, Enrollment> assignment = new AssignmentMap<Request, Enrollment>();
758758
CourseRequest crq = SectioningRequest.convert(assignment, r, server, wlMode, helper);
759+
SectioningRequest.setDependentCourses(crq, server);
759760
Collection<Enrollment> avEnrls = crq.getAvaiableEnrollmentsSkipSameTime(assignment);
760761
for (Iterator<Enrollment> e = avEnrls.iterator(); e.hasNext();) {
761762
Enrollment enrl = e.next();

JavaSource/org/unitime/timetable/onlinesectioning/solver/SectioningRequest.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121

2222
import java.util.ArrayList;
2323
import java.util.Collection;
24+
import java.util.HashMap;
2425
import java.util.HashSet;
2526
import java.util.List;
27+
import java.util.Map;
2628
import java.util.Set;
2729

2830
import org.cpsolver.coursett.model.RoomLocation;
@@ -59,6 +61,7 @@
5961
import org.unitime.timetable.onlinesectioning.OnlineSectioningServer;
6062
import org.unitime.timetable.onlinesectioning.basic.GetInfo;
6163
import org.unitime.timetable.onlinesectioning.basic.GetAssignment.CourseSection;
64+
import org.unitime.timetable.onlinesectioning.model.XCourse;
6265
import org.unitime.timetable.onlinesectioning.model.XCourseId;
6366
import org.unitime.timetable.onlinesectioning.model.XCourseRequest;
6467
import org.unitime.timetable.onlinesectioning.model.XEnrollment;
@@ -450,6 +453,37 @@ public boolean sameLastName(Section current, Course course) {
450453
return false;
451454
}
452455

456+
public static void setDependentCourses(CourseRequest cr, OnlineSectioningServer server) {
457+
if (cr == null || server == null) return;
458+
XStudent student = server.getStudent(cr.getStudent().getId());
459+
if (student == null) return;
460+
Map<Long, Long> parentCourses = new HashMap<Long, Long>();
461+
for (XRequest r: student.getRequests()) {
462+
if (r instanceof XCourseRequest) {
463+
for (XCourseId c: ((XCourseRequest)r).getCourseIds()) {
464+
XCourse course = server.getCourse(c.getCourseId());
465+
if (course != null && course.getParentCourseId() != null)
466+
parentCourses.put(course.getCourseId(), course.getParentCourseId());
467+
}
468+
}
469+
}
470+
if (!parentCourses.isEmpty()) {
471+
Map<Long, Course> courseTable = new HashMap<Long, Course>();
472+
for (Request r: cr.getStudent().getRequests()) {
473+
if (r instanceof CourseRequest) {
474+
for (Course course: ((CourseRequest)r).getCourses())
475+
courseTable.put(course.getId(), course);
476+
}
477+
}
478+
for (Map.Entry<Long, Long> e: parentCourses.entrySet()) {
479+
Course course = courseTable.get(e.getKey());
480+
Course parent = courseTable.get(e.getValue());
481+
if (course != null && parent != null)
482+
course.setParent(parent);
483+
}
484+
}
485+
}
486+
453487
public static CourseRequest convert(Assignment<Request, Enrollment> assignment, XCourseRequest request, OnlineSectioningServer server, WaitListMode wlMode, OnlineSectioningHelper helper) {
454488
XCourseId dropCourse = (request.isWaitlist(wlMode) ? request.getWaitListSwapWithCourseOffering() : null);
455489
return convert(assignment, request, dropCourse, server, wlMode, helper);

WebContent/help/Release-Notes.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@
3838
</description>
3939
</item>
4040
</category>
41+
<category>
42+
<title>Student Scheduling</title>
43+
<item>
44+
<name>Solver Dashboard: Dependent Courses</name>
45+
<description>
46+
<line>Show the "Not-assigned associated course {0}." message when applicable while showing student details (List of Classes).</line>
47+
</description>
48+
</item>
49+
</category>
4150
</release>
4251

4352
<release>

0 commit comments

Comments
 (0)