SEBSERV-417 try fix corrupt Moodle data

This commit is contained in:
anhefti 2024-06-12 09:15:34 +02:00
parent 7a3e3a2492
commit 1ef62af9a5
3 changed files with 6 additions and 1 deletions

View file

@ -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)

View file

@ -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

View file

@ -622,6 +622,7 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
protected Result<Exam> notifySaved(final Exam entity) {
return this.examAdminService.notifyExamSaved(entity)
.flatMap(this.examAdminService::applyQuitPassword)
.flatMap(this.fullLmsIntegrationService::applyExamDataToLMS)
.flatMap(this.examSessionService::flushCache);
}