diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/AdditionalAttributesDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/AdditionalAttributesDAOImpl.java index c963e9a2..d3643909 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/AdditionalAttributesDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/AdditionalAttributesDAOImpl.java @@ -21,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional; import ch.ethz.seb.sebserver.gbl.api.EntityType; import ch.ethz.seb.sebserver.gbl.profile.WebServiceProfile; import ch.ethz.seb.sebserver.gbl.util.Result; +import ch.ethz.seb.sebserver.gbl.util.Utils; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.AdditionalAttributeRecordDynamicSqlSupport; import ch.ethz.seb.sebserver.webservice.datalayer.batis.mapper.AdditionalAttributeRecordMapper; import ch.ethz.seb.sebserver.webservice.datalayer.batis.model.AdditionalAttributeRecord; @@ -124,7 +125,7 @@ public class AdditionalAttributesDAOImpl implements AdditionalAttributesDAO { type.name(), entityId, name, - value); + Utils.truncateText(value, 4000)); this.additionalAttributeRecordMapper .updateByPrimaryKeySelective(rec); @@ -136,7 +137,7 @@ public class AdditionalAttributesDAOImpl implements AdditionalAttributesDAO { type.name(), entityId, name, - value); + Utils.truncateText(value, 4000)); this.additionalAttributeRecordMapper .insert(rec); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionControlTask.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionControlTask.java index 4ccbc16e..6b72916f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionControlTask.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionControlTask.java @@ -170,19 +170,21 @@ public class ExamSessionControlTask implements DisposableBean { }); // update per LMS Setup - examToLMSMapping.entrySet().stream().forEach(updateEntry -> { - final Result> updateExamFromLMS = this.examUpdateHandler - .updateExamFromLMS(updateEntry.getKey(), updateEntry.getValue()); + examToLMSMapping.entrySet() + .stream() + .forEach(updateEntry -> { + final Result> updateExamFromLMS = this.examUpdateHandler + .updateExamFromLMS(updateEntry.getKey(), updateEntry.getValue()); - if (updateExamFromLMS.hasError()) { - log.error("Failed to update exams from LMS: ", updateExamFromLMS.getError()); - } else { - final Set failedExams = updateExamFromLMS.get(); - if (!failedExams.isEmpty()) { - log.warn("Failed to update following exams from LMS: {}", failedExams); - } - } - }); + if (updateExamFromLMS.hasError()) { + log.error("Failed to update exams from LMS: ", updateExamFromLMS.getError()); + } else { + final Set failedExams = updateExamFromLMS.get(); + if (!failedExams.isEmpty()) { + log.warn("Failed to update following exams from LMS: {}", failedExams); + } + } + }); } catch (final Exception e) { log.error("Unexpected error while update exams from LMS: ", e); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamUpdateHandler.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamUpdateHandler.java index 4cf9edaf..e3730943 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamUpdateHandler.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamUpdateHandler.java @@ -24,6 +24,7 @@ import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.model.exam.Exam; import ch.ethz.seb.sebserver.gbl.model.exam.Exam.ExamStatus; import ch.ethz.seb.sebserver.gbl.model.exam.QuizData; @@ -243,7 +244,8 @@ class ExamUpdateHandler { log.info("Try to recover quiz data for Moodle quiz with internal identifier: {}", quizId); - if (exam != null && exam.name != null) { + if (exam != null && exam.name != null + && !exam.name.startsWith(Constants.SQUARE_BRACE_OPEN.toString())) { log.debug("Found formerName quiz name: {}", exam.name); @@ -282,7 +284,7 @@ class ExamUpdateHandler { } } - if (exam.isLmsAvailable()) { + if (exam.lmsAvailable == null || exam.isLmsAvailable()) { this.examDAO.markLMSAvailability(quizId, false, updateId); } throw new RuntimeException("Not Available");