diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamRecordDAO.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamRecordDAO.java index ba763705..9eb9c27c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamRecordDAO.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamRecordDAO.java @@ -317,7 +317,7 @@ public class ExamRecordDAO { .set(quitPassword).equalTo(getEncryptedQuitPassword(exam.quitPassword)) .set(browserKeys).equalToWhenPresent(exam.browserExamKeys) .set(lmsSebRestriction).equalTo(1) // seb restriction (deprecated) - .set(examTemplateId).equalTo(exam.examTemplateId) + .set(examTemplateId).equalTo(oldRecord.getExamTemplateId()) .set(lastModified).equalTo(Utils.getMillisecondsNow()) .set(quizName).equalToWhenPresent(exam.lmsSetupId == null ? exam.name : null) .set(quizStartTime).equalToWhenPresent(exam.lmsSetupId == null ? exam.startTime : null) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/FullLmsIntegrationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/FullLmsIntegrationServiceImpl.java index 1b935d17..5640ef23 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/FullLmsIntegrationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/FullLmsIntegrationServiceImpl.java @@ -541,6 +541,10 @@ public class FullLmsIntegrationServiceImpl implements FullLmsIntegrationService } private Exam applyExamData(final Exam exam, final boolean deletion) { + if (exam.examTemplateId == null) { + throw new IllegalStateException("Exam has no template id: " + exam.getName()); + } + try { final LmsAPITemplate lmsAPITemplate = lmsAPITemplateCacheService 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 63d3b97e..631e0a65 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 @@ -622,6 +622,7 @@ public class ExamAdministrationController extends EntityController { protected Result notifySaved(final Exam entity) { return this.examAdminService.notifyExamSaved(entity) .flatMap(this.examAdminService::applyQuitPassword) + .flatMap(this.fullLmsIntegrationService::applyExamDataToLMS) .flatMap(this.examSessionService::flushCache); }