Skip to content

Commit efd2ed6

Browse files
committed
Add/Edit Room: Preferences
- do not allow for Required preference (for a department) unless there is already a required department for the room - required preference set directly on a room usually makes no or very little sense and usually only creates confusion when a room is accidentally marked as required (as no other rooms can be used for the department by the course timetabling solver)
1 parent a0ec316 commit efd2ed6

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

JavaSource/org/unitime/timetable/gwt/client/rooms/RoomEdit.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -885,8 +885,10 @@ else if (!type.isRoom() && iRoom.getBuilding() == null)
885885
for (Map.Entry<Long, CheckBox> e: iServices.entrySet())
886886
e.getValue().setValue(false);
887887
if (iRoom.hasServices())
888-
for (EventServiceProviderInterface service: iRoom.getServices())
889-
iServices.get(service.getId()).setValue(true);
888+
for (EventServiceProviderInterface service: iRoom.getServices()) {
889+
CheckBox ch = iServices.get(service.getId());
890+
if (ch != null) ch.setValue(true);
891+
}
890892
if (iProperties.hasEventServiceProviders()) {
891893
Long deptId = Long.valueOf(iEventDepartment.getValue(iEventDepartment.getSelectedIndex()));
892894
for (EventServiceProviderInterface service: iProperties.getEventServiceProviders()) {

JavaSource/org/unitime/timetable/server/rooms/RoomPropertiesBackend.java

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public RoomPropertiesInterface execute(RoomPropertiesRequest request, SessionCon
8484
Session session = SessionDAO.getInstance().get(request.hasSessionId() ? request.getSessionId() : context.getUser().getCurrentAcademicSessionId());
8585
response.setAcademicSession(new AcademicSessionInterface(session.getUniqueId(), session.getAcademicTerm() + " " + session.getAcademicYear()));
8686
authority = context.getUser().getCurrentAuthority();
87+
if (!request.hasSessionId()) request.setSessionId(session.getUniqueId());
8788
}
8889

8990
response.setCanEditDepartments(context.hasPermission(Right.EditRoomDepartments));

JavaSource/org/unitime/timetable/server/rooms/RoomSharingBackend.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,18 @@ public RoomSharingModel loadRoomSharing(Location location, boolean includeRoomPr
121121
model.setNoteEditable(editable);
122122

123123
if (includeRoomPreferences) {
124+
boolean hasReq = false;
125+
if (location != null && location.getRoomDepts() != null)
126+
for (RoomDept rd: location.getRoomDepts())
127+
if (rd.getPreference() != null && PreferenceLevel.sRequired.equals(rd.getPreference().getPrefProlog())) {
128+
hasReq = true;
129+
break;
130+
}
124131
boolean prefEditable = (location == null ? context.getUser().getCurrentAuthority().hasRight(Right.RoomEditPreference) : context.hasPermission(location, Right.RoomEditPreference));
125-
for (PreferenceLevel pref: PreferenceLevel.getPreferenceLevelList(false))
126-
model.addPreference(new PreferenceInterface(pref.getUniqueId(), PreferenceLevel.prolog2bgColor(pref.getPrefProlog()), pref.getPrefProlog(), pref.getPrefName(), pref.getAbbreviation(), prefEditable));
132+
for (PreferenceLevel pref: PreferenceLevel.getPreferenceLevelList(false)) {
133+
if (hasReq || !PreferenceLevel.sRequired.equals(pref.getPrefProlog()))
134+
model.addPreference(new PreferenceInterface(pref.getUniqueId(), PreferenceLevel.prolog2bgColor(pref.getPrefProlog()), pref.getPrefProlog(), pref.getPrefName(), pref.getAbbreviation(), prefEditable));
135+
}
127136
}
128137

129138
boolean deptIndependent = context.getUser().getCurrentAuthority().hasRight(Right.DepartmentIndependent);

WebContent/help/Release-Notes.xml

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
<line>Date Pattern: Corrected the name of the default date pattern when a date pattern is set on the scheduling subpart.</line>
3737
</description>
3838
</item>
39+
<item>
40+
<name>Add/Edit Room</name>
41+
<description>
42+
<line>Preference: Do not allow for Required preference (for a department) unless there is already a required department for the room.
43+
<line>Required preference set directly on a room usually makes no or very little sense and usually only creates confusion when a room is accidentally marked as required (as no other rooms can be used for the department by the course timetabling solver).</line>
44+
</line>
45+
</description>
46+
</item>
3947
</category>
4048
<category>
4149
<title>Student Scheduling</title>

0 commit comments

Comments
 (0)