Merge branch 'dev-1.6' into development

This commit is contained in:
anhefti 2024-05-02 12:02:03 +02:00
commit 91212c65be
2 changed files with 19 additions and 1 deletions

View file

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

View file

@ -717,6 +717,24 @@ public class ResourceService {
.collect(Collectors.toList());
}
public List<Tuple<String>> 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<Tuple<String>> getExamResources() {
final UserInfo userInfo = this.currentUser.get();
return this.restService.getBuilder(GetExamNames.class)