diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ExamDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ExamDAO.java index 1cc0b602..370cbfa1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ExamDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/ExamDAO.java @@ -84,7 +84,7 @@ public interface ExamDAO extends ActivatableEntityDAO, BulkActionSup * @param filterMap FilterMap with other filter criteria * @param status the list of ExamStatus * @return Result refer to collection of exam identifiers or to an error if happened */ - Result> getExamIdsForStatus( + Result> getExamsForStatus( final FilterMap filterMap, final Predicate predicate, final ExamStatus... status); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/FilterMap.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/FilterMap.java index a9a5b3d5..85ce64fe 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/FilterMap.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/FilterMap.java @@ -60,7 +60,7 @@ public class FilterMap extends POSTMapper { } public Integer getActiveAsInt() { - return getBooleanAsInteger(UserInfo.FILTER_ATTR_ACTIVE); + return getBooleanAsInteger(Entity.FILTER_ATTR_ACTIVE); } public Long getInstitutionId() { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java index cbd17475..448ed0af 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java @@ -256,7 +256,7 @@ public class ExamDAOImpl implements ExamDAO { @Override @Transactional(readOnly = true) - public Result> getExamIdsForStatus( + public Result> getExamsForStatus( final FilterMap filterMap, final Predicate predicate, final ExamStatus... status) { @@ -269,7 +269,8 @@ public class ExamDAOImpl implements ExamDAO { .collect(Collectors.toList()) : null; final Predicate examDataFilter = createPredicate(filterMap); - return this.examRecordDAO.allMatching(filterMap, stateNames) + return this.examRecordDAO + .allMatching(filterMap, stateNames) .flatMap(this::toDomainModel) .getOrThrow() .stream() diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java index 15de3342..b413c5c9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionServiceImpl.java @@ -33,6 +33,7 @@ import org.springframework.stereotype.Service; import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.api.APIMessage; import ch.ethz.seb.sebserver.gbl.api.APIMessage.ErrorMessage; +import ch.ethz.seb.sebserver.gbl.model.Entity; import ch.ethz.seb.sebserver.gbl.model.exam.Exam; import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamStatus; import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection; @@ -264,7 +265,9 @@ public class ExamSessionServiceImpl implements ExamSessionService { final FilterMap filterMap, final Predicate predicate) { - return this.examDAO.getExamIdsForStatus( + filterMap.putIfAbsent(Entity.FILTER_ATTR_ACTIVE, Constants.TRUE_STRING); + + return this.examDAO.getExamsForStatus( filterMap, predicate, ExamStatus.FINISHED, diff --git a/src/main/resources/config/application-dev-ws.properties b/src/main/resources/config/application-dev-ws.properties index c45a499e..6d85c2b3 100644 --- a/src/main/resources/config/application-dev-ws.properties +++ b/src/main/resources/config/application-dev-ws.properties @@ -25,7 +25,7 @@ sebserver.webservice.clean-db-on-startup=false # webservice configuration sebserver.init.adminaccount.gen-on-init=false -sebserver.webservice.distributed=false +sebserver.webservice.distributed=true #sebserver.webservice.master.delay.threshold=10000 sebserver.webservice.http.external.scheme=http sebserver.webservice.http.external.servername=localhost