SEBSERV-543 fixed selection filter
This commit is contained in:
parent
7e2baedc03
commit
c8ff644e7d
2 changed files with 19 additions and 1 deletions
|
@ -416,7 +416,7 @@ public class SEBClientConfigForm implements TemplateComposer {
|
||||||
SEBClientConfig.ATTR_EXAM_SELECTION,
|
SEBClientConfig.ATTR_EXAM_SELECTION,
|
||||||
FORM_EXAM_SELECTION_TEXT_KEY,
|
FORM_EXAM_SELECTION_TEXT_KEY,
|
||||||
StringUtils.join(clientConfig.selectedExams, Constants.LIST_SEPARATOR),
|
StringUtils.join(clientConfig.selectedExams, Constants.LIST_SEPARATOR),
|
||||||
() -> pageService.getResourceService().getExamLogSelectionResources())
|
() -> pageService.getResourceService().getActiveExamResources())
|
||||||
.withInputSpan(5))
|
.withInputSpan(5))
|
||||||
.withDefaultSpanEmptyCell(1);
|
.withDefaultSpanEmptyCell(1);
|
||||||
|
|
||||||
|
|
|
@ -717,6 +717,24 @@ public class ResourceService {
|
||||||
.collect(Collectors.toList());
|
.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() {
|
public List<Tuple<String>> getExamResources() {
|
||||||
final UserInfo userInfo = this.currentUser.get();
|
final UserInfo userInfo = this.currentUser.get();
|
||||||
return this.restService.getBuilder(GetExamNames.class)
|
return this.restService.getBuilder(GetExamNames.class)
|
||||||
|
|
Loading…
Reference in a new issue