Skip to content

Commit

Permalink
Add/Edit Room: Preferences
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
tomas-muller committed Jul 25, 2024
1 parent a151776 commit 9344000
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,10 @@ else if (!type.isRoom() && iRoom.getBuilding() == null)
for (Map.Entry<Long, CheckBox> e: iServices.entrySet())
e.getValue().setValue(false);
if (iRoom.hasServices())
for (EventServiceProviderInterface service: iRoom.getServices())
iServices.get(service.getId()).setValue(true);
for (EventServiceProviderInterface service: iRoom.getServices()) {
CheckBox ch = iServices.get(service.getId());
if (ch != null) ch.setValue(true);
}
if (iProperties.hasEventServiceProviders()) {
Long deptId = Long.valueOf(iEventDepartment.getValue(iEventDepartment.getSelectedIndex()));
for (EventServiceProviderInterface service: iProperties.getEventServiceProviders()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public RoomPropertiesInterface execute(RoomPropertiesRequest request, SessionCon
Session session = SessionDAO.getInstance().get(request.hasSessionId() ? request.getSessionId() : context.getUser().getCurrentAcademicSessionId());
response.setAcademicSession(new AcademicSessionInterface(session.getUniqueId(), session.getAcademicTerm() + " " + session.getAcademicYear()));
authority = context.getUser().getCurrentAuthority();
if (!request.hasSessionId()) request.setSessionId(session.getUniqueId());
}

response.setCanEditDepartments(context.hasPermission(Right.EditRoomDepartments));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,18 @@ public RoomSharingModel loadRoomSharing(Location location, boolean includeRoomPr
model.setNoteEditable(editable);

if (includeRoomPreferences) {
boolean hasReq = false;
if (location != null && location.getRoomDepts() != null)
for (RoomDept rd: location.getRoomDepts())
if (rd.getPreference() != null && PreferenceLevel.sRequired.equals(rd.getPreference().getPrefProlog())) {
hasReq = true;
break;
}
boolean prefEditable = (location == null ? context.getUser().getCurrentAuthority().hasRight(Right.RoomEditPreference) : context.hasPermission(location, Right.RoomEditPreference));
for (PreferenceLevel pref: PreferenceLevel.getPreferenceLevelList(false))
model.addPreference(new PreferenceInterface(pref.getUniqueId(), PreferenceLevel.prolog2bgColor(pref.getPrefProlog()), pref.getPrefProlog(), pref.getPrefName(), pref.getAbbreviation(), prefEditable));
for (PreferenceLevel pref: PreferenceLevel.getPreferenceLevelList(false)) {
if (hasReq || !PreferenceLevel.sRequired.equals(pref.getPrefProlog()))
model.addPreference(new PreferenceInterface(pref.getUniqueId(), PreferenceLevel.prolog2bgColor(pref.getPrefProlog()), pref.getPrefProlog(), pref.getPrefName(), pref.getAbbreviation(), prefEditable));
}
}

boolean deptIndependent = context.getUser().getCurrentAuthority().hasRight(Right.DepartmentIndependent);
Expand Down
8 changes: 8 additions & 0 deletions WebContent/help/Release-Notes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
<line>Date Pattern: Corrected the name of the default date pattern when a date pattern is set on the scheduling subpart.</line>
</description>
</item>
<item>
<name>Add/Edit Room</name>
<description>
<line>Preference: Do not allow for Required preference (for a department) unless there is already a required department for the room.
<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>
</line>
</description>
</item>
</category>
<category>
<title>Student Scheduling</title>
Expand Down

0 comments on commit 9344000

Please sign in to comment.