SEBSERV-168 fixed. Missed to apply the filter after refactoring

This commit is contained in:
anhefti 2021-02-15 10:03:20 +01:00
parent e5f9cf33cf
commit 256b59e566
4 changed files with 21 additions and 5 deletions

View file

@ -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<>(

View file

@ -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<List<QuizData>> 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

View file

@ -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<List<QuizData>> 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

View file

@ -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