From 3a5129f7965bf95f0d5a94e255a7f68f4ca3a005 Mon Sep 17 00:00:00 2001 From: anhefti Date: Wed, 12 Jun 2024 09:42:14 +0200 Subject: [PATCH] SEBSERV-417 try fix corrupt Moodle data --- .../lms/impl/FullLmsIntegrationServiceImpl.java | 10 +++++++++- .../weblayer/api/ExamAdministrationController.java | 9 --------- 2 files changed, 9 insertions(+), 10 deletions(-) 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 5640ef23..e2d3caf4 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 @@ -145,7 +145,15 @@ public class FullLmsIntegrationServiceImpl implements FullLmsIntegrationService @Override public Result 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 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 631e0a65..f2f6ff18 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 @@ -733,15 +733,6 @@ public class ExamAdministrationController extends EntityController { 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 {