SEBSERV-257 fixed sorting for start date and type
This commit is contained in:
		
							parent
							
								
									95c3f31cb9
								
							
						
					
					
						commit
						499c01e943
					
				
					 4 changed files with 11 additions and 4 deletions
				
			
		|  | @ -269,7 +269,11 @@ public class PaginationServiceImpl implements PaginationService { | |||
|         final Map<String, String> 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); | ||||
| 
 | ||||
|  |  | |||
|  | @ -154,13 +154,15 @@ public abstract class EntityController<T extends Entity, M extends Entity> { | |||
|         final FilterMap filterMap = new FilterMap(allRequestParams, request.getQueryString()); | ||||
|         populateFilterMap(filterMap, institutionId, sort); | ||||
| 
 | ||||
|         return this.paginationService.getPage( | ||||
|         final Page<T> 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) { | ||||
|  |  | |||
|  | @ -152,7 +152,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> { | |||
|         //       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<Exam, Exam> { | |||
|             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)); | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti