@@ -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 );
0 commit comments