Merge remote-tracking branch 'origin/dev-1.4' into development
This commit is contained in:
commit
fdc778fc0b
5 changed files with 47 additions and 22 deletions
2
pom.xml
2
pom.xml
|
@ -18,7 +18,7 @@
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<sebserver-version>1.4.0-SNAPSHOT</sebserver-version>
|
<sebserver-version>1.4.1-SNAPSHOT</sebserver-version>
|
||||||
<build-version>${sebserver-version}</build-version>
|
<build-version>${sebserver-version}</build-version>
|
||||||
<revision>${sebserver-version}</revision>
|
<revision>${sebserver-version}</revision>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class LmsAPITemplateAdapter implements LmsAPITemplate {
|
||||||
throw new RuntimeException("No course API Access: " + testCourseAccessAPI);
|
throw new RuntimeException("No course API Access: " + testCourseAccessAPI);
|
||||||
}
|
}
|
||||||
return testCourseAccessAPI;
|
return testCourseAccessAPI;
|
||||||
});
|
}).getOrThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -92,25 +92,25 @@ public class MockCourseAccessAPI implements CourseAccessAPI {
|
||||||
null,
|
null,
|
||||||
"http://lms.mockup.com/api/"));
|
"http://lms.mockup.com/api/"));
|
||||||
|
|
||||||
if (webserviceInfo.hasProfile("dev")) {
|
// if (webserviceInfo.hasProfile("dev")) {
|
||||||
for (int i = 12; i < 50; i++) {
|
// for (int i = 12; i < 50; i++) {
|
||||||
this.mockups.add(new QuizData(
|
// this.mockups.add(new QuizData(
|
||||||
"quiz10" + i, institutionId, lmsSetupId, lmsType, "Demo Quiz 10 " + i + " (MOCKUP)",
|
// "quiz10" + i, institutionId, lmsSetupId, lmsType, "Demo Quiz 10 " + i + " (MOCKUP)",
|
||||||
i + "_Starts in a minute and ends after five minutes",
|
// i + "_Starts in a minute and ends after five minutes",
|
||||||
DateTime.now(DateTimeZone.UTC).plus(Constants.MINUTE_IN_MILLIS)
|
// DateTime.now(DateTimeZone.UTC).plus(Constants.MINUTE_IN_MILLIS)
|
||||||
.toString(Constants.DEFAULT_DATE_TIME_FORMAT),
|
// .toString(Constants.DEFAULT_DATE_TIME_FORMAT),
|
||||||
DateTime.now(DateTimeZone.UTC).plus(6 * Constants.MINUTE_IN_MILLIS)
|
// DateTime.now(DateTimeZone.UTC).plus(6 * Constants.MINUTE_IN_MILLIS)
|
||||||
.toString(Constants.DEFAULT_DATE_TIME_FORMAT),
|
// .toString(Constants.DEFAULT_DATE_TIME_FORMAT),
|
||||||
"http://lms.mockup.com/api/"));
|
// "http://lms.mockup.com/api/"));
|
||||||
this.mockups.add(new QuizData(
|
// this.mockups.add(new QuizData(
|
||||||
"quiz11" + i, institutionId, lmsSetupId, lmsType, "Demo Quiz 11 " + i + " (MOCKUP)",
|
// "quiz11" + i, institutionId, lmsSetupId, lmsType, "Demo Quiz 11 " + i + " (MOCKUP)",
|
||||||
i + "_Starts in a minute and ends never",
|
// i + "_Starts in a minute and ends never",
|
||||||
DateTime.now(DateTimeZone.UTC).plus(Constants.MINUTE_IN_MILLIS)
|
// DateTime.now(DateTimeZone.UTC).plus(Constants.MINUTE_IN_MILLIS)
|
||||||
.toString(Constants.DEFAULT_DATE_TIME_FORMAT),
|
// .toString(Constants.DEFAULT_DATE_TIME_FORMAT),
|
||||||
null,
|
// null,
|
||||||
"http://lms.mockup.com/api/"));
|
// "http://lms.mockup.com/api/"));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -137,7 +137,7 @@ public class MoodleRestTemplateFactory {
|
||||||
log.warn("Failed to get access token for LMS: {}({})",
|
log.warn("Failed to get access token for LMS: {}({})",
|
||||||
lmsSetup.name,
|
lmsSetup.name,
|
||||||
lmsSetup.id,
|
lmsSetup.id,
|
||||||
result.getError());
|
result.getError().getMessage());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
|
|
|
@ -88,6 +88,31 @@ class ExamUpdateHandler {
|
||||||
final Set<String> failedOrMissing = new HashSet<>(exams.keySet());
|
final Set<String> failedOrMissing = new HashSet<>(exams.keySet());
|
||||||
final String updateId = this.createUpdateId();
|
final String updateId = this.createUpdateId();
|
||||||
|
|
||||||
|
// test overall LMS access
|
||||||
|
try {
|
||||||
|
this.lmsAPIService
|
||||||
|
.getLmsAPITemplate(lmsSetupId)
|
||||||
|
.getOrThrow()
|
||||||
|
.checkCourseAPIAccess();
|
||||||
|
} catch (final Exception e) {
|
||||||
|
log.warn("No LMS access, mark all exams of the LMS as not connected to LMS");
|
||||||
|
if (!failedOrMissing.isEmpty()) {
|
||||||
|
failedOrMissing
|
||||||
|
.stream()
|
||||||
|
.forEach(quizId -> {
|
||||||
|
try {
|
||||||
|
final Exam exam = exams.get(quizId);
|
||||||
|
if (exam.lmsAvailable == null || exam.isLmsAvailable()) {
|
||||||
|
this.examDAO.markLMSAvailability(quizId, false, updateId);
|
||||||
|
}
|
||||||
|
} catch (final Exception ee) {
|
||||||
|
log.error("Failed to mark exam: {} as not connected to LMS", quizId, ee);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return failedOrMissing;
|
||||||
|
}
|
||||||
|
|
||||||
this.lmsAPIService
|
this.lmsAPIService
|
||||||
.getLmsAPITemplate(lmsSetupId)
|
.getLmsAPITemplate(lmsSetupId)
|
||||||
.map(template -> {
|
.map(template -> {
|
||||||
|
|
Loading…
Reference in a new issue