From 6ebe53773fc70cd65ef1bd64459a0ad8b6d94132 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 30 Aug 2016 18:17:25 +0200 Subject: [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. --- .../java/org/openslx/dozmod/gui/window/LectureListWindow.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'dozentenmodul/src/main/java') 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, Integer> filterActive = new RowFilter, Integer>() { public boolean include(Entry, ? 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, Integer> filterExpiring = new RowFilter, Integer>() { public boolean include(Entry, ? 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; } }; -- cgit v1.2.3-55-g7522