diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/configs/SEBClientConfigForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/configs/SEBClientConfigForm.java index 369bfb2b..5f85cfea 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/configs/SEBClientConfigForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/configs/SEBClientConfigForm.java @@ -416,7 +416,7 @@ public class SEBClientConfigForm implements TemplateComposer { SEBClientConfig.ATTR_EXAM_SELECTION, FORM_EXAM_SELECTION_TEXT_KEY, StringUtils.join(clientConfig.selectedExams, Constants.LIST_SEPARATOR), - () -> pageService.getResourceService().getExamLogSelectionResources()) + () -> pageService.getResourceService().getActiveExamResources()) .withInputSpan(5)) .withDefaultSpanEmptyCell(1); diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/ResourceService.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/ResourceService.java index c12c7892..3c31a084 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/ResourceService.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/ResourceService.java @@ -717,6 +717,24 @@ public class ResourceService { .collect(Collectors.toList()); } + public List> getActiveExamResources() { + final UserInfo userInfo = this.currentUser.get(); + return this.restService.getBuilder(GetExams.class) + .withQueryParam(Entity.FILTER_ATTR_INSTITUTION, String.valueOf(userInfo.getInstitutionId())) + .withQueryParam(Exam.FILTER_CACHED_QUIZZES, Constants.TRUE_STRING) + .call() + .getOr(Collections.emptyList()) + .stream() + .filter(exam -> exam != null && + exam.getStatus() != ExamStatus.FINISHED && + exam.getStatus() != ExamStatus.ARCHIVED) + .map(exam -> new Tuple<>( + exam.getModelId(), + StringUtils.isBlank(exam.name) ? exam.externalId : exam.name)) + .sorted(RESOURCE_COMPARATOR) + .collect(Collectors.toList()); + } + public List> getExamResources() { final UserInfo userInfo = this.currentUser.get(); return this.restService.getBuilder(GetExamNames.class)