diff options
| author | Simon Rettberg | 2016-08-30 18:17:25 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2016-08-30 18:17:25 +0200 |
| commit | 6ebe53773fc70cd65ef1bd64459a0ad8b6d94132 (patch) | |
| tree | 3fbbcef074b13e537e7cc755978f7b95e7c9bcda | |
| parent | [client] Don't allow upload of snapshotted VMs (diff) | |
| download | tutor-module-6ebe53773fc70cd65ef1bd64459a0ad8b6d94132.tar.gz tutor-module-6ebe53773fc70cd65ef1bd64459a0ad8b6d94132.tar.xz tutor-module-6ebe53773fc70cd65ef1bd64459a0ad8b6d94132.zip | |
[client] Fix "show only active lectures" to consider end date
Start date is still ignored, there should be quite few lectures
starting in the future anyways so this might be desireable behavior.
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java index 6064aa49..6a6a99c3 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/window/LectureListWindow.java @@ -51,6 +51,7 @@ import org.openslx.dozmod.thrift.ThriftActions.DeleteLectureCallback; import org.openslx.dozmod.thrift.cache.LectureCache; import org.openslx.dozmod.thrift.cache.UserCache; import org.openslx.util.QuickTimer; +import org.openslx.util.Util; import org.openslx.util.QuickTimer.Task; /** @@ -113,7 +114,8 @@ public class LectureListWindow extends LectureListWindowLayout { // filter for active lectures private final RowFilter<ListModel<LectureSummary>, Integer> filterActive = new RowFilter<ListModel<LectureSummary>, Integer>() { public boolean include(Entry<? extends ListModel<LectureSummary>, ? extends Integer> entry) { - return tblLectures.getModelRow(entry.getIdentifier()).isEnabled; + LectureSummary lecture = tblLectures.getModelRow(entry.getIdentifier()); + return lecture.isEnabled && lecture.endTime > Util.unixTime(); } }; // filter for editable lectures @@ -126,11 +128,7 @@ public class LectureListWindow extends LectureListWindowLayout { private final RowFilter<ListModel<LectureSummary>, Integer> filterExpiring = new RowFilter<ListModel<LectureSummary>, Integer>() { public boolean include(Entry<? extends ListModel<LectureSummary>, ? extends Integer> entry) { LectureSummary selLect = tblLectures.getModelRow(entry.getIdentifier()); - long end = selLect.getEndTime() * 1000l; - Calendar cal = Calendar.getInstance(); - cal.setTime(new Date()); - cal.add(Calendar.DATE, 7); - return cal.getTimeInMillis() > end ? true : false; + return Math.abs(selLect.endTime - Util.unixTime()) < 86400 * 7; } }; |
