SEBSERV-239

This commit is contained in:
anhefti 2021-11-02 10:04:57 +01:00
parent 39cac216e0
commit daeb118210
5 changed files with 12 additions and 11 deletions

View file

@ -128,9 +128,9 @@ public final class Indicator implements Entity {
this.thresholds = Utils.immutableListOf(thresholds);
}
public Indicator(final Exam exam, final POSTMapper postParams) {
public Indicator(final Long examId, final POSTMapper postParams) {
this.id = null;
this.examId = exam.id;
this.examId = examId;
this.name = postParams.getString(Domain.INDICATOR.ATTR_NAME);
this.type = postParams.getEnum(Domain.INDICATOR.ATTR_TYPE, IndicatorType.class);
this.defaultColor = postParams.getString(Domain.INDICATOR.ATTR_COLOR);

View file

@ -131,7 +131,8 @@ public class ExamAPI_V1_Controller {
.map(this::createRunningExamInfo)
.collect(Collectors.toList());
} else {
final Exam exam = this.examSessionService.getExamDAO().byPK(examId)
final Exam exam = this.examSessionService.getExamDAO()
.byPK(examId)
.getOrThrow();
result = Arrays.asList(createRunningExamInfo(exam));

View file

@ -327,7 +327,7 @@ public class ExamProctoringController {
this.authorizationService.checkRead(this.examSessionService
.getExamDAO()
.byPK(examId)
.examGrantEntityByPK(examId)
.getOrThrow());
}

View file

@ -72,11 +72,10 @@ public class IndicatorController extends EntityController<Indicator, Indicator>
@Override
protected Indicator createNew(final POSTMapper postParams) {
final Long examId = postParams.getLong(Domain.INDICATOR.ATTR_EXAM_ID);
return this.examDao
.byPK(examId)
.map(exam -> new Indicator(exam, postParams))
.getOrThrow();
if (examId == null) {
throw new RuntimeException("Missing exam model id from request parameter map!");
}
return new Indicator(examId, postParams);
}
@Override
@ -120,7 +119,8 @@ public class IndicatorController extends EntityController<Indicator, Indicator>
return null;
}
return this.examDao.byPK(entity.examId)
return this.examDao
.examGrantEntityByPK(entity.examId)
.getOrThrow();
}

View file

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