Skip to content

Commit

Permalink
Scheduling Assistant, Dashboards: Hard/Long Distance Conflicts
Browse files Browse the repository at this point in the history
- Long Distance Conflicts: a distance conflict is considered long, when the travel time is HardDistanceConflict.DistanceLongLimitInMinutes (default to 60) minutes
  - long distance conflicts show a different icon in the user interface (a red racing car instead of a road runner)
- when a student cannot be enrolled in a course due to a hard distance conflict, show a Conflicts with X warning message
  - just like when the course is conflicting with some other course X due to time overlaps
- allow for hard distance conflicts when student checks the "Include conflicting suggestions" toggle
  • Loading branch information
tomas-muller committed Jan 17, 2025
1 parent 0b8fd1e commit 4d94113
Show file tree
Hide file tree
Showing 20 changed files with 332 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public void onSuccess(RetrieveAvailableGradeModesResponse result) {
new WebTable.Cell(clazz.getStartString(CONSTANTS.useAmPm())).aria(clazz.getStartStringAria(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getEndString(CONSTANTS.useAmPm())).aria(clazz.getEndStringAria(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getDatePattern()),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(vcc != null ? vcc : new WebTable.AbbvTextCell(clazz.getCredit())),
new WebTable.Cell(pendingCredit == null ? "" : MESSAGES.credit(pendingCredit)),
(change == null ? new WebTable.Cell("") : firstClazz ? change : new GradeModeLabel(change, gradeMode)),
Expand All @@ -383,7 +383,7 @@ public void onSuccess(RetrieveAvailableGradeModesResponse result) {
new WebTable.Cell(clazz.getSection()),
new WebTable.Cell(MESSAGES.arrangeHours(), 3, null),
new WebTable.Cell(clazz.getDatePattern()),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(vcc != null ? vcc : new WebTable.AbbvTextCell(clazz.getCredit())),
new WebTable.Cell(pendingCredit == null ? "" : MESSAGES.credit(pendingCredit)),
(change == null ? new WebTable.Cell("") : firstClazz ? change : new GradeModeLabel(change, gradeMode)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ protected void fillInAssignments() {
new WebTable.Cell(clazz.getStartString(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getEndString(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getDatePattern()),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
new WebTable.InstructorCell(clazz.getInstructors(), clazz.getInstructorEmails(), ", "),
new WebTable.Cell(clazz.getParentSection()),
clazz.hasNote() ? new WebTable.IconCell(RESOURCES.note(), clazz.getNote(), "") : new WebTable.Cell(""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void populate(Collection<CourseAssignment> data) {
new WebTable.Cell(clazz.getLimitString()),
new WebTable.Cell(clazz.getDaysString(CONSTANTS.shortDays()) + " " + clazz.getStartString(CONSTANTS.useAmPm()) + " - " + clazz.getEndString(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getDatePattern()),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
new WebTable.InstructorCell(clazz.getInstructors(), clazz.getInstructorEmails(), ", "),
new WebTable.Cell(clazz.getParentSection()),
clazz.hasNote() ? new WebTable.IconCell(RESOURCES.note(), clazz.getNote(), "") : new WebTable.Cell(""),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ else if (clazz.hasWarn())
new WebTable.Cell(clazz.getStartString(CONSTANTS.useAmPm())).aria(clazz.getStartStringAria(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getEndString(CONSTANTS.useAmPm())).aria(clazz.getEndStringAria(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getDatePattern()),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
new WebTable.InstructorCell(clazz.getInstructors(), clazz.getInstructorEmails(), ", "),
new WebTable.Cell(clazz.getParentSection(), clazz.getParentSection() == null || clazz.getParentSection().length() > 10),
new WebTable.NoteCell(clazz.getOverlapAndNote("text-red"), clazz.getOverlapAndNote(null)),
Expand All @@ -1782,7 +1782,7 @@ else if (clazz.hasWarn())
new WebTable.Cell(clazz.getLimitString()),
new WebTable.Cell(MESSAGES.arrangeHours(), 3, null),
new WebTable.Cell(clazz.hasDatePattern() ? clazz.getDatePattern() : ""),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
new WebTable.InstructorCell(clazz.getInstructors(), clazz.getInstructorEmails(), ", "),
new WebTable.Cell(clazz.getParentSection(), clazz.getParentSection() == null || clazz.getParentSection().length() > 10),
new WebTable.NoteCell(clazz.getOverlapAndNote("text-red"), clazz.getOverlapAndNote(null)),
Expand Down Expand Up @@ -2195,7 +2195,7 @@ public void onSuccess(ClassAssignmentInterface result) {
new WebTable.Cell(clazz.getStartString(CONSTANTS.useAmPm())).aria(clazz.getStartStringAria(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getEndString(CONSTANTS.useAmPm())).aria(clazz.getEndStringAria(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getDatePattern()),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
new WebTable.InstructorCell(clazz.getInstructors(), clazz.getInstructorEmails(), ", "),
new WebTable.Cell(clazz.getParentSection(), clazz.getParentSection() == null || clazz.getParentSection().length() > 10),
new WebTable.NoteCell(clazz.getOverlapAndNote("text-red"), clazz.getOverlapAndNote(null)),
Expand All @@ -2212,7 +2212,7 @@ public void onSuccess(ClassAssignmentInterface result) {
new WebTable.Cell(clazz.getLimitString()),
new WebTable.Cell(MESSAGES.arrangeHours(), 3, null),
new WebTable.Cell(clazz.hasDatePattern() ? clazz.getDatePattern() : ""),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
new WebTable.InstructorCell(clazz.getInstructors(), clazz.getInstructorEmails(), ", "),
new WebTable.Cell(clazz.getParentSection(), clazz.getParentSection() == null || clazz.getParentSection().length() > 10),
new WebTable.NoteCell(clazz.getOverlapAndNote("text-red"), clazz.getOverlapAndNote(null)),
Expand Down Expand Up @@ -2295,7 +2295,7 @@ public void onSuccess(ClassAssignmentInterface result) {
new WebTable.Cell(clazz.getStartString(CONSTANTS.useAmPm())).aria(clazz.getStartStringAria(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getEndString(CONSTANTS.useAmPm())).aria(clazz.getEndStringAria(CONSTANTS.useAmPm())),
new WebTable.Cell(clazz.getDatePattern()),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
new WebTable.InstructorCell(clazz.getInstructors(), clazz.getInstructorEmails(), ", "),
new WebTable.Cell(clazz.getParentSection(), clazz.getParentSection() == null || clazz.getParentSection().length() > 10),
new WebTable.NoteCell(clazz.getOverlapAndNote("text-red"), clazz.getOverlapAndNote(null)),
Expand All @@ -2312,7 +2312,7 @@ public void onSuccess(ClassAssignmentInterface result) {
new WebTable.Cell(clazz.getLimitString()),
new WebTable.Cell(MESSAGES.arrangeHours(), 3, null),
new WebTable.Cell(clazz.hasDatePattern() ? clazz.getDatePattern() : ""),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
(clazz.hasDistanceConflict() ? new WebTable.RoomCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()), clazz.getRooms(), ", ") : new WebTable.RoomCell(clazz.getRooms(), ", ")),
new WebTable.InstructorCell(clazz.getInstructors(), clazz.getInstructorEmails(), ", "),
new WebTable.Cell(clazz.getParentSection(), clazz.getParentSection() == null || clazz.getParentSection().length() > 10),
new WebTable.NoteCell(clazz.getOverlapAndNote("text-red"), clazz.getOverlapAndNote(null)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ public void showResults(Collection<ClassAssignmentInterface> result) {
new WebTable.Cell(compare(dates(old), dates(clazz), CmpMode.BOTH_OLD, selected, clazz == null)),
new WebTable.Cell(compare(dates(old), dates(clazz), CmpMode.BOTH_NEW, selected, clazz == null)),
(clazz != null && clazz.hasDistanceConflict() ?
new WebTable.IconCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()),
new WebTable.IconCell(clazz.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(clazz.getBackToBackRooms(), clazz.getBackToBackDistance()),
compare(room(old), room(clazz), CmpMode.BOTH_OLD, selected, clazz == null)) :
new WebTable.Cell(compare(room(old), room(clazz), CmpMode.BOTH_OLD, selected, clazz == null))),
new WebTable.Cell(compare(room(old), room(clazz), CmpMode.BOTH_NEW, selected, clazz == null)),
Expand Down Expand Up @@ -511,7 +511,7 @@ public void showResults(Collection<ClassAssignmentInterface> result) {
new WebTable.Cell(compare(dates(old), dates(clazz), CmpMode.BOTH_OLD, false, clazz == null)),
new WebTable.Cell(compare(dates(old), dates(clazz), CmpMode.BOTH_NEW, false, clazz == null)),
(old != null && old.hasDistanceConflict() ?
new WebTable.IconCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(old.getBackToBackRooms(), old.getBackToBackDistance()),
new WebTable.IconCell(old.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(old.getBackToBackRooms(), old.getBackToBackDistance()),
compare(room(old), room(clazz), CmpMode.BOTH_OLD, false, clazz == null)) :
new WebTable.Cell(compare(room(old), room(clazz), CmpMode.BOTH_OLD, false, clazz == null))),
new WebTable.Cell(compare(room(old), room(clazz), CmpMode.BOTH_NEW, false, clazz == null)),
Expand Down Expand Up @@ -561,7 +561,7 @@ public void showResults(Collection<ClassAssignmentInterface> result) {
new WebTable.Cell(compare(dates(old), dates(clazz), CmpMode.BOTH_OLD, false, clazz == null)),
new WebTable.Cell(compare(dates(old), dates(clazz), CmpMode.BOTH_NEW, false, clazz == null)),
(old != null && old.hasDistanceConflict() ?
new WebTable.IconCell(RESOURCES.distantConflict(), MESSAGES.backToBackDistance(old.getBackToBackRooms(), old.getBackToBackDistance()),
new WebTable.IconCell(old.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict(), MESSAGES.backToBackDistance(old.getBackToBackRooms(), old.getBackToBackDistance()),
compare(room(old), room(clazz), CmpMode.BOTH_OLD, false, clazz == null)) :
new WebTable.Cell(compare(room(old), room(clazz), CmpMode.BOTH_OLD, false, clazz == null))),
new WebTable.Cell(compare(room(old), room(clazz), CmpMode.BOTH_NEW, false, clazz == null)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public ArrayList<Meeting> addClass(ClassAssignmentInterface.ClassAssignment row,
for (Meeting m: meetings) m.setPinned(true);
if (row.hasDistanceConflict()) {
for (Meeting m: meetings) {
Widget dist = new Image(RESOURCES.distantConflict());
Widget dist = new Image(row.hasLongDistanceConflict() ? RESOURCES.longDistantConflict() : RESOURCES.distantConflict());
if (iPrint) {
dist = new Label(MESSAGES.distanceConflict(row.getBackToBackDistance()));
dist.setStyleName("label");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public interface StudentSectioningResources extends ClientBundle {
@Source("org/unitime/timetable/gwt/resources/icons/roadrunner16.png")
ImageResource distantConflict();

@Source("org/unitime/timetable/gwt/resources/icons/car-13.png")
ImageResource longDistantConflict();

@Source("org/unitime/timetable/gwt/resources/icons/tick.png")
ImageResource saved();

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ public static class ClassAssignment implements IsSerializable, Serializable {
private GradeMode iGradeMode = null;
private Float iCreditHour = null, iCreditMin = null, iCreditMax = null;
private Boolean iCanWaitList = null;
private boolean iLongDistanceConflict = false;

public ClassAssignment() {}
public ClassAssignment(CourseAssignment course) {
Expand Down Expand Up @@ -663,6 +664,9 @@ public void setAvailable(Boolean available) {
public boolean hasDistanceConflict() { return iDistanceConflict; }
public void setDistanceConflict(boolean distanceConflict) { iDistanceConflict = distanceConflict; }

public boolean hasLongDistanceConflict() { return iLongDistanceConflict; }
public void setLongDistanceConflict(boolean longDistanceConflict) { iLongDistanceConflict = longDistanceConflict; }

public int getBackToBackDistance() { return iBackToBackDistance; }
public void setBackToBackDistance(int backToBackDistance) { iBackToBackDistance = backToBackDistance; }

Expand Down
Loading

0 comments on commit 4d94113

Please sign in to comment.