SEBSERV-417 try fix corrupt Moodle data

This commit is contained in:
anhefti 2024-06-12 09:42:14 +02:00
parent 1ef62af9a5
commit 3a5129f796
2 changed files with 9 additions and 10 deletions

View file

@ -145,7 +145,15 @@ public class FullLmsIntegrationServiceImpl implements FullLmsIntegrationService
@Override
public Result<Exam> applyExamDataToLMS(final Exam exam) {
return Result.tryCatch(() -> this.applyExamData(exam, false));
return Result.tryCatch(() -> {
final LmsSetup lmsSetup = lmsSetupDAO.byPK(exam.lmsSetupId).getOrThrow();
if (lmsSetup.lmsType.features.contains(LmsSetup.Features.LMS_FULL_INTEGRATION)) {
return this.applyExamData(exam, false);
}
return exam;
});
}
@Override

View file

@ -733,15 +733,6 @@ public class ExamAdministrationController extends EntityController<Exam, Exam> {
return this.checkNoActiveSEBClientConnections(exam)
.flatMap(this.sebRestrictionService::applySEBClientRestriction)
// TODO temporary try to fix corrupted data on Moodle site
.onErrorDo(error -> {
if (error.getMessage().contains("no SebServer Info!")) {
log.info("**** try to reset exam_data on Moodle 2.0 with temporary hack... ");
fullLmsIntegrationService.applyExamDataToLMS(exam)
.onError(e -> log.error("Failed to apply exam data: ", error));
}
return this.sebRestrictionService.applySEBClientRestriction(exam).getOrThrow();
})
.flatMap(e -> this.examDAO.setSEBRestriction(exam.id, restrict))
.getOrThrow();
} else {