diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/QuizLookupList.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/QuizLookupList.java index a6ae673e..a60278ae 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/QuizLookupList.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/QuizLookupList.java @@ -115,9 +115,11 @@ public class QuizLookupList implements TemplateComposer { private final ResourceService resourceService; private final PageService pageService; private final int pageSize; + private final DateTime filterStartDate; protected QuizLookupList( final PageService pageService, + @Value("${sebserver.gui.filter.date.from.years:2}") final Integer startYearFromNow, @Value("${sebserver.gui.list.page.size:20}") final Integer pageSize) { this.pageService = pageService; @@ -125,6 +127,10 @@ public class QuizLookupList implements TemplateComposer { this.resourceService = pageService.getResourceService(); this.pageSize = pageSize; + this.filterStartDate = Utils + .toDateTimeUTC(Utils.getMillisecondsNow()) + .minusYears(startYearFromNow); + this.institutionFilter = new TableFilterAttribute( CriteriaType.SINGLE_SELECTION, Entity.FILTER_ATTR_INSTITUTION, @@ -194,9 +200,7 @@ public class QuizLookupList implements TemplateComposer { .withFilter(new TableFilterAttribute( CriteriaType.DATE, QuizData.FILTER_ATTR_START_TIME, - Utils.toDateTimeUTC(Utils.getMillisecondsNow()) - .minusYears(1) - .toString())) + this.filterStartDate.toString())) .sortable()) .withColumn(new ColumnDefinition<>( diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/edx/OpenEdxLmsAPITemplate.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/edx/OpenEdxLmsAPITemplate.java index 206c9a78..ccc8a806 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/edx/OpenEdxLmsAPITemplate.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/edx/OpenEdxLmsAPITemplate.java @@ -28,6 +28,7 @@ import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetupTestResult; import ch.ethz.seb.sebserver.gbl.model.user.ExamineeAccountDetails; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap; +import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPIService; import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPITemplate; final class OpenEdxLmsAPITemplate implements LmsAPITemplate { @@ -65,7 +66,11 @@ final class OpenEdxLmsAPITemplate implements LmsAPITemplate { @Override public Result> getQuizzes(final FilterMap filterMap) { - return this.openEdxCourseAccess.getQuizzes(filterMap); + return this.openEdxCourseAccess + .getQuizzes(filterMap) + .map(quizzes -> quizzes.stream() + .filter(LmsAPIService.quizFilterPredicate(filterMap)) + .collect(Collectors.toList())); } @Override diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/MoodleLmsAPITemplate.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/MoodleLmsAPITemplate.java index ef71a33d..8cd903bc 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/MoodleLmsAPITemplate.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/MoodleLmsAPITemplate.java @@ -28,6 +28,7 @@ import ch.ethz.seb.sebserver.gbl.model.institution.LmsSetupTestResult; import ch.ethz.seb.sebserver.gbl.model.user.ExamineeAccountDetails; import ch.ethz.seb.sebserver.gbl.util.Result; import ch.ethz.seb.sebserver.webservice.servicelayer.dao.FilterMap; +import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPIService; import ch.ethz.seb.sebserver.webservice.servicelayer.lms.LmsAPITemplate; import ch.ethz.seb.sebserver.webservice.servicelayer.lms.impl.NoSEBRestrictionException; @@ -67,7 +68,11 @@ public class MoodleLmsAPITemplate implements LmsAPITemplate { @Override public Result> getQuizzes(final FilterMap filterMap) { - return this.moodleCourseAccess.getQuizzes(filterMap); + return this.moodleCourseAccess + .getQuizzes(filterMap) + .map(quizzes -> quizzes.stream() + .filter(LmsAPIService.quizFilterPredicate(filterMap)) + .collect(Collectors.toList())); } @Override diff --git a/src/main/resources/config/application-gui.properties b/src/main/resources/config/application-gui.properties index 8e729d65..d1e795d6 100644 --- a/src/main/resources/config/application-gui.properties +++ b/src/main/resources/config/application-gui.properties @@ -31,6 +31,8 @@ sebserver.gui.webservice.moodle-lms-enabled=true sebserver.gui.seb.client.config.download.filename=SEBServerSettings.seb sebserver.gui.seb.exam.config.download.filename=SEBExamSettings.seb +sebserver.gui.filter.date.from.years=2 + # remote proctoring sebserver.gui.remote.proctoring.entrypoint=/remote-proctoring sebserver.gui.remote.proctoring.api-servler.endpoint=/remote-view-servlet