SEBSERV-326

This commit is contained in:
anhefti 2022-06-22 09:20:29 +02:00
parent 1c896c827d
commit 5fe710e966
5 changed files with 10 additions and 6 deletions

View file

@ -84,7 +84,7 @@ public interface ExamDAO extends ActivatableEntityDAO<Exam, Exam>, BulkActionSup
* @param filterMap FilterMap with other filter criteria * @param filterMap FilterMap with other filter criteria
* @param status the list of ExamStatus * @param status the list of ExamStatus
* @return Result refer to collection of exam identifiers or to an error if happened */ * @return Result refer to collection of exam identifiers or to an error if happened */
Result<Collection<Exam>> getExamIdsForStatus( Result<Collection<Exam>> getExamsForStatus(
final FilterMap filterMap, final FilterMap filterMap,
final Predicate<Exam> predicate, final Predicate<Exam> predicate,
final ExamStatus... status); final ExamStatus... status);

View file

@ -60,7 +60,7 @@ public class FilterMap extends POSTMapper {
} }
public Integer getActiveAsInt() { public Integer getActiveAsInt() {
return getBooleanAsInteger(UserInfo.FILTER_ATTR_ACTIVE); return getBooleanAsInteger(Entity.FILTER_ATTR_ACTIVE);
} }
public Long getInstitutionId() { public Long getInstitutionId() {

View file

@ -256,7 +256,7 @@ public class ExamDAOImpl implements ExamDAO {
@Override @Override
@Transactional(readOnly = true) @Transactional(readOnly = true)
public Result<Collection<Exam>> getExamIdsForStatus( public Result<Collection<Exam>> getExamsForStatus(
final FilterMap filterMap, final FilterMap filterMap,
final Predicate<Exam> predicate, final Predicate<Exam> predicate,
final ExamStatus... status) { final ExamStatus... status) {
@ -269,7 +269,8 @@ public class ExamDAOImpl implements ExamDAO {
.collect(Collectors.toList()) .collect(Collectors.toList())
: null; : null;
final Predicate<Exam> examDataFilter = createPredicate(filterMap); final Predicate<Exam> examDataFilter = createPredicate(filterMap);
return this.examRecordDAO.allMatching(filterMap, stateNames) return this.examRecordDAO
.allMatching(filterMap, stateNames)
.flatMap(this::toDomainModel) .flatMap(this::toDomainModel)
.getOrThrow() .getOrThrow()
.stream() .stream()

View file

@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.Constants;
import ch.ethz.seb.sebserver.gbl.api.APIMessage; import ch.ethz.seb.sebserver.gbl.api.APIMessage;
import ch.ethz.seb.sebserver.gbl.api.APIMessage.ErrorMessage; 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;
import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamStatus; import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamStatus;
import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection; import ch.ethz.seb.sebserver.gbl.model.session.ClientConnection;
@ -264,7 +265,9 @@ public class ExamSessionServiceImpl implements ExamSessionService {
final FilterMap filterMap, final FilterMap filterMap,
final Predicate<Exam> predicate) { final Predicate<Exam> predicate) {
return this.examDAO.getExamIdsForStatus( filterMap.putIfAbsent(Entity.FILTER_ATTR_ACTIVE, Constants.TRUE_STRING);
return this.examDAO.getExamsForStatus(
filterMap, filterMap,
predicate, predicate,
ExamStatus.FINISHED, ExamStatus.FINISHED,

View file

@ -25,7 +25,7 @@ sebserver.webservice.clean-db-on-startup=false
# webservice configuration # webservice configuration
sebserver.init.adminaccount.gen-on-init=false sebserver.init.adminaccount.gen-on-init=false
sebserver.webservice.distributed=false sebserver.webservice.distributed=true
#sebserver.webservice.master.delay.threshold=10000 #sebserver.webservice.master.delay.threshold=10000
sebserver.webservice.http.external.scheme=http sebserver.webservice.http.external.scheme=http
sebserver.webservice.http.external.servername=localhost sebserver.webservice.http.external.servername=localhost