Skip to content

Commit

Permalink
Instructional Offering Cross Lists
Browse files Browse the repository at this point in the history
- fix the instructors and offering coordinators when the controlling department is changed
  - this means that each instructor/coordinator gets replaced with an instructor/coordinator from the controlling department with the matching external id
  - an instructor/coordinator assignment gets deleted otherwise (the instructor has no external id or no matching instructor in the new controlling department)
  • Loading branch information
tomas-muller committed Sep 15, 2023
1 parent e5ed219 commit 17f3299
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,18 @@
import org.unitime.timetable.model.AdvisorCourseRequest;
import org.unitime.timetable.model.AdvisorSectioningPref;
import org.unitime.timetable.model.ChangeLog;
import org.unitime.timetable.model.ClassInstructor;
import org.unitime.timetable.model.Class_;
import org.unitime.timetable.model.CourseOffering;
import org.unitime.timetable.model.CourseRequest;
import org.unitime.timetable.model.CurriculumCourse;
import org.unitime.timetable.model.Department;
import org.unitime.timetable.model.DepartmentalInstructor;
import org.unitime.timetable.model.Event;
import org.unitime.timetable.model.Exam;
import org.unitime.timetable.model.InstrOfferingConfig;
import org.unitime.timetable.model.InstructionalOffering;
import org.unitime.timetable.model.OfferingCoordinator;
import org.unitime.timetable.model.SchedulingSubpart;
import org.unitime.timetable.model.SubjectArea;
import org.unitime.timetable.model.comparators.CourseOfferingComparator;
Expand Down Expand Up @@ -537,9 +540,45 @@ private void doUpdate()
cls.setManagingDept(dept, sessionContext.getUser(), hibSession);
hibSession.saveOrUpdate(cls);
}
// Fix class instructors
for (Iterator<ClassInstructor> i = cls.getClassInstructors().iterator(); i.hasNext();) {
ClassInstructor ci = i.next();
if (!ci.getInstructor().getDepartment().equals(dept)) {
ci.getInstructor().getClasses().remove(ci);
DepartmentalInstructor di = (ci.getInstructor().getExternalUniqueId() == null ? null :
DepartmentalInstructor.findByPuidDepartmentId(ci.getInstructor().getExternalUniqueId(), dept.getUniqueId(), hibSession));
if (di == null) {
hibSession.delete(ci);
i.remove();
} else {
ci.setInstructor(di);
di.getClasses().add(ci);
hibSession.update(ci);
}
}
}
}
}
}
if (io.getOfferingCoordinators() != null) {
// Fix offering coordinators
for (Iterator<OfferingCoordinator> i = io.getOfferingCoordinators().iterator(); i.hasNext(); ) {
OfferingCoordinator oc = i.next();
if (!oc.getInstructor().getDepartment().equals(dept)) {
oc.getInstructor().getOfferingCoordinators().remove(oc);
DepartmentalInstructor di = (oc.getInstructor().getExternalUniqueId() == null ? null :
DepartmentalInstructor.findByPuidDepartmentId(oc.getInstructor().getExternalUniqueId(), dept.getUniqueId(), hibSession));
if (di == null) {
hibSession.delete(oc);
i.remove();
} else {
oc.setInstructor(di);
di.getOfferingCoordinators().add(oc);
hibSession.update(oc);
}
}
}
}


ChangeLog.addChange(
Expand Down
9 changes: 9 additions & 0 deletions WebContent/help/Release-Notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@
<line>Added ability to select an imported solution (that does not have any GlobalInfo saved).</line>
</description>
</item>
<item>
<name>Instructional Offering Cross Lists</name>
<description>
<line>Fix the instructors and offering coordinators when the controlling department is changed.
<line>This means that each instructor/coordinator gets replaced with an instructor/coordinator from the controlling department with the matching external id.</line>
<line>An instructor/coordinator assignment gets deleted otherwise (the instructor has no external id or no matching instructor in the new controlling department).</line>
</line>
</description>
</item>
</category>
<category>
<title>Administration</title>
Expand Down

0 comments on commit 17f3299

Please sign in to comment.