From efd2ed681b0873b22a10f5d16aa5a16b30b34272 Mon Sep 17 00:00:00 2001 From: tomas-muller Date: Wed, 24 Jul 2024 16:39:56 +0200 Subject: [PATCH] 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) --- .../timetable/gwt/client/rooms/RoomEdit.java | 6 ++++-- .../server/rooms/RoomPropertiesBackend.java | 1 + .../timetable/server/rooms/RoomSharingBackend.java | 13 +++++++++++-- WebContent/help/Release-Notes.xml | 8 ++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/JavaSource/org/unitime/timetable/gwt/client/rooms/RoomEdit.java b/JavaSource/org/unitime/timetable/gwt/client/rooms/RoomEdit.java index d029f557df..9f645bd647 100644 --- a/JavaSource/org/unitime/timetable/gwt/client/rooms/RoomEdit.java +++ b/JavaSource/org/unitime/timetable/gwt/client/rooms/RoomEdit.java @@ -885,8 +885,10 @@ else if (!type.isRoom() && iRoom.getBuilding() == null) for (Map.Entry 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()) { diff --git a/JavaSource/org/unitime/timetable/server/rooms/RoomPropertiesBackend.java b/JavaSource/org/unitime/timetable/server/rooms/RoomPropertiesBackend.java index 334e081735..95cdabb386 100644 --- a/JavaSource/org/unitime/timetable/server/rooms/RoomPropertiesBackend.java +++ b/JavaSource/org/unitime/timetable/server/rooms/RoomPropertiesBackend.java @@ -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)); diff --git a/JavaSource/org/unitime/timetable/server/rooms/RoomSharingBackend.java b/JavaSource/org/unitime/timetable/server/rooms/RoomSharingBackend.java index a09361a0f1..87d48b9e84 100644 --- a/JavaSource/org/unitime/timetable/server/rooms/RoomSharingBackend.java +++ b/JavaSource/org/unitime/timetable/server/rooms/RoomSharingBackend.java @@ -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); diff --git a/WebContent/help/Release-Notes.xml b/WebContent/help/Release-Notes.xml index 50fbe5e296..93293da76f 100644 --- a/WebContent/help/Release-Notes.xml +++ b/WebContent/help/Release-Notes.xml @@ -36,6 +36,14 @@ Date Pattern: Corrected the name of the default date pattern when a date pattern is set on the scheduling subpart. + + Add/Edit Room + + Preference: 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). + + + Student Scheduling