diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/PaginationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/PaginationServiceImpl.java index 6083b130..eadf45e1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/PaginationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/PaginationServiceImpl.java @@ -269,7 +269,11 @@ public class PaginationServiceImpl implements PaginationService { final Map examTableMap = new HashMap<>(); examTableMap.put(Entity.FILTER_ATTR_INSTITUTION, institutionNameRef); examTableMap.put(Domain.EXAM.ATTR_LMS_SETUP_ID, lmsSetupNameRef); - examTableMap.put(Domain.EXAM.ATTR_TYPE, ExamRecordDynamicSqlSupport.type.name()); + + // NOTE: This seems not to work and I was not able to figure out why. + // Now the type sorting is done within secondary sort for exams. + //examTableMap.put(Domain.EXAM.ATTR_TYPE, "'" + ExamRecordDynamicSqlSupport.type.name() + "'"); + this.sortColumnMapping.put(ExamRecordDynamicSqlSupport.examRecord.name(), examTableMap); this.defaultSortColumn.put(ExamRecordDynamicSqlSupport.examRecord.name(), Domain.EXAM.ATTR_ID); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java index c3471521..3f8359c1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/EntityController.java @@ -154,13 +154,15 @@ public abstract class EntityController { final FilterMap filterMap = new FilterMap(allRequestParams, request.getQueryString()); populateFilterMap(filterMap, institutionId, sort); - return this.paginationService.getPage( + final Page page = this.paginationService.getPage( pageNumber, pageSize, sort, getSQLTableOfEntity().name(), () -> getAll(filterMap)) .getOrThrow(); + + return page; } protected void populateFilterMap(final FilterMap filterMap, final Long institutionId, final String sort) { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java index 40f9229d..d5af2298 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamAdministrationController.java @@ -152,7 +152,7 @@ public class ExamAdministrationController extends EntityController { // of the SEB Server. Therefore in the case we have no or the default sorting we can use the // native PaginationService within MyBatis and SQL. For the other cases we need an in-line sorting and paging if (StringUtils.isBlank(sort) || - this.paginationService.isNativeSortingSupported(ExamRecordDynamicSqlSupport.examRecord, sort)) { + (this.paginationService.isNativeSortingSupported(ExamRecordDynamicSqlSupport.examRecord, sort))) { return super.getPage(institutionId, pageNumber, pageSize, sort, allRequestParams, request); @@ -592,7 +592,7 @@ public class ExamAdministrationController extends EntityController { if (sortBy.equals(Exam.FILTER_ATTR_TYPE)) { list.sort(Comparator.comparing(exam -> exam.type)); } - if (sortBy.equals(QuizData.FILTER_ATTR_START_TIME)) { + if (sortBy.equals(QuizData.FILTER_ATTR_START_TIME) || sortBy.equals(QuizData.QUIZ_ATTR_START_TIME)) { list.sort(Comparator.comparing(exam -> exam.startTime)); } diff --git a/src/main/resources/config/application-dev.properties b/src/main/resources/config/application-dev.properties index ef27950c..e7329017 100644 --- a/src/main/resources/config/application-dev.properties +++ b/src/main/resources/config/application-dev.properties @@ -17,6 +17,7 @@ logging.level.ch.ethz.seb.sebserver.webservice.servicelayer.session.impl.indicat #logging.level.ch.ethz.seb.sebserver.webservice.servicelayer.dao.impl=DEBUG #logging.level.ch.ethz.seb.sebserver.webservice.datalayer.batis=DEBUG #logging.level.ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper=DEBUG +logging.level.ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.ExamRecordMapper=DEBUG #logging.level.ch.ethz.seb.sebserver.webservice.weblayer.api.ExamAPI_V1_Controller=TRACE logging.level.com.zaxxer.hikari=DEBUG