fixed exam quiz data update

This commit is contained in:
anhefti 2022-05-25 09:00:52 +02:00
parent b7717ed2de
commit ceb2a53c83
5 changed files with 12 additions and 6 deletions

View file

@ -16,6 +16,7 @@ import java.util.Map;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
@ -295,6 +296,11 @@ public final class Exam implements GrantEntity {
return this.lmsAvailable; return this.lmsAvailable;
} }
@JsonIgnore
public boolean isLmsAvailable() {
return BooleanUtils.isTrue(this.lmsAvailable);
}
public String getExternalId() { public String getExternalId() {
return this.externalId; return this.externalId;
} }

View file

@ -596,7 +596,7 @@ public class ExamForm implements TemplateComposer {
} }
private boolean testSEBRestrictionAPI(final Exam exam) { private boolean testSEBRestrictionAPI(final Exam exam) {
if (!exam.lmsAvailable) { if (!exam.isLmsAvailable()) {
return false; return false;
} }

View file

@ -274,7 +274,7 @@ public class ExamList implements TemplateComposer {
final Exam exam, final Exam exam,
final PageService pageService) { final PageService pageService) {
if (BooleanUtils.isFalse(exam.lmsAvailable)) { if (BooleanUtils.isFalse(exam.isLmsAvailable())) {
item.setData(RWT.CUSTOM_VARIANT, CustomVariant.DISABLED.key); item.setData(RWT.CUSTOM_VARIANT, CustomVariant.DISABLED.key);
return; return;
} }

View file

@ -132,7 +132,7 @@ public class ExamSessionServiceImpl implements ExamSessionService {
.getOrThrow(); .getOrThrow();
// check lms connection // check lms connection
if (!exam.lmsAvailable) { if (!exam.isLmsAvailable()) {
result.add(ErrorMessage.EXAM_CONSISTENCY_VALIDATION_LMS_CONNECTION.of(exam.getModelId())); result.add(ErrorMessage.EXAM_CONSISTENCY_VALIDATION_LMS_CONNECTION.of(exam.getModelId()));
} }

View file

@ -108,7 +108,7 @@ class ExamUpdateHandler {
log.error("Failed to update quiz data for exam: {}", quiz, log.error("Failed to update quiz data for exam: {}", quiz,
updateQuizData.getError()); updateQuizData.getError());
} else { } else {
if (!exam.lmsAvailable) { if (!exam.isLmsAvailable()) {
this.examDAO.markLMSAvailability(quiz.id, true, updateId); this.examDAO.markLMSAvailability(quiz.id, true, updateId);
} }
failedOrMissing.remove(quiz.id); failedOrMissing.remove(quiz.id);
@ -116,7 +116,7 @@ class ExamUpdateHandler {
} }
} else { } else {
if (!exam.lmsAvailable) { if (!exam.isLmsAvailable()) {
this.examDAO.markLMSAvailability(quiz.id, true, updateId); this.examDAO.markLMSAvailability(quiz.id, true, updateId);
} }
failedOrMissing.remove(quiz.id); failedOrMissing.remove(quiz.id);
@ -282,7 +282,7 @@ class ExamUpdateHandler {
} }
} }
if (exam.lmsAvailable) { if (exam.isLmsAvailable()) {
this.examDAO.markLMSAvailability(quizId, false, updateId); this.examDAO.markLMSAvailability(quizId, false, updateId);
} }
throw new RuntimeException("Not Available"); throw new RuntimeException("Not Available");