Skip to content

Commit bb27473

Browse files
committed
Batch Student Scheduling: Section Times
- added ability to load arranged hours (no time) classes with a time (listing the date pattern but no time) and rooms (that are required by the class) - this allows the effective date pattern and required room to show on arranged hours classes on the solver dashboard - can be disabled by setting the solver parameter Load.ArrangedHoursPlacements to false (defaults to true)
1 parent 6053f01 commit bb27473

4 files changed

Lines changed: 34 additions & 1 deletion

File tree

79 Bytes
Binary file not shown.

JavaSource/org/unitime/timetable/server/sectioning/StudentSchedulingSolutionStatisticsReport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ public String[] getValues(StudentGroup group, StudentSectioningModel model, Assi
954954
if (e != null && e.isCourseRequest()) {
955955
for (Section section: e.getSections()) {
956956
if (section.isOnline()) onlineClass ++;
957-
if (section.getTime() == null) arrClass ++;
957+
if (!section.hasTime()) arrClass ++;
958958
allClass ++;
959959
}
960960
}

JavaSource/org/unitime/timetable/solver/studentsct/StudentSectioningDatabaseLoader.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ private static enum IgnoreNotAssigned { all, other, none }
256256
private boolean iUseAdvisorWaitLists = false;
257257
private Date iClassesPastDate = null;
258258
private int iClassesPastDateIndex = 0;
259+
private boolean iLoadArrangedHoursPlacements = true;
259260

260261
public StudentSectioningDatabaseLoader(StudentSectioningModel model, org.cpsolver.ifs.assignment.Assignment<Request, Enrollment> assignment) {
261262
super(model, assignment);
@@ -408,6 +409,7 @@ public StudentSectioningDatabaseLoader(StudentSectioningModel model, org.cpsolve
408409
iStudentHoldsCheckProvider = Customization.StudentHoldsCheckProvider.getProvider();
409410

410411
iUseAdvisorWaitLists = model.getProperties().getPropertyBoolean("Load.UseAdvisorWaitLists", iUseAdvisorWaitLists);
412+
iLoadArrangedHoursPlacements = model.getProperties().getPropertyBoolean("Load.ArrangedHoursPlacements", iLoadArrangedHoursPlacements);
411413
}
412414

413415
public void load() {
@@ -847,6 +849,31 @@ private Offering loadOffering(InstructionalOffering io, Hashtable<Long, Course>
847849
datePatternName(a.getDatePattern(), p.getTimeLocation()),
848850
p.getTimeLocation().getWeekCode());
849851
}
852+
if (p == null && iLoadArrangedHoursPlacements) {
853+
DatePattern dp = c.effectiveDatePattern();
854+
if (dp != null) {
855+
TimeLocation tl = new TimeLocation(0, 0, 0, 0, 0.0, dp.getUniqueId(), datePatternName(dp, null), dp.getPatternBitSet(), 0);
856+
List<RoomLocation> rooms = new ArrayList<RoomLocation>();
857+
for (Iterator<?> it = c.effectivePreferences(RoomPref.class).iterator(); it.hasNext(); ) {
858+
RoomPref rp = (RoomPref)it.next();
859+
if (PreferenceLevel.sRequired.equals(rp.getPrefLevel().getPrefProlog())) {
860+
Location room = rp.getRoom();
861+
RoomLocation rl = new RoomLocation(
862+
room.getUniqueId(),
863+
room.getLabel(),
864+
(room instanceof Room? ((Room)room).getBuilding().getUniqueId() : null),
865+
0,
866+
room.getCapacity().intValue(),
867+
room.getCoordinateX(),
868+
room.getCoordinateY(),
869+
room.isIgnoreTooFar().booleanValue(),
870+
null);
871+
rooms.add(rl);
872+
}
873+
}
874+
p = new Placement(null, tl, rooms);
875+
}
876+
}
850877
Section section = new Section(c.getUniqueId().longValue(), getSectionLimit(c, true), (c.getClassSuffix() == null ? c.getSectionNumberString() : c.getClassSuffix()), subpart, p,
851878
getInstructors(c), parentSection);
852879
if (iCheckEnabledForScheduling && !c.isEnabledForStudentScheduling())
@@ -2207,6 +2234,12 @@ private String datePatternName(DatePattern dp, TimeLocation time) {
22072234
if ("never".equals(iDatePatternFormat)) return dp.getName();
22082235
if ("extended".equals(iDatePatternFormat) && dp.getType() != DatePattern.sTypeExtended) return dp.getName();
22092236
if ("alternate".equals(iDatePatternFormat) && dp.getType() == DatePattern.sTypeAlternate) return dp.getName();
2237+
if (time == null) {
2238+
Formats.Format<Date> dpf = Formats.getDateFormat(Formats.Pattern.DATE_PATTERN);
2239+
Date first = dp.getStartDate();
2240+
Date last = dp.getEndDate();
2241+
return dpf.format(first) + (first.equals(last) ? "" : " - " + dpf.format(last));
2242+
}
22102243
if (time.getWeekCode().isEmpty()) return time.getDatePatternName();
22112244
Calendar cal = Calendar.getInstance(Locale.US); cal.setLenient(true);
22122245
cal.setTime(iDatePatternFirstDate);
12 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)