added logging for Moodle quiz recovering
This commit is contained in:
parent
d69d7b7c64
commit
a17da0923b
1 changed files with 12 additions and 0 deletions
|
@ -823,6 +823,9 @@ public class ExamDAOImpl implements ExamDAO {
|
||||||
final LmsSetup lmsSetup = this.lmsAPIService.getLmsSetup(record.getLmsSetupId())
|
final LmsSetup lmsSetup = this.lmsAPIService.getLmsSetup(record.getLmsSetupId())
|
||||||
.getOrThrow();
|
.getOrThrow();
|
||||||
if (lmsSetup.lmsType == LmsType.MOODLE) {
|
if (lmsSetup.lmsType == LmsType.MOODLE) {
|
||||||
|
|
||||||
|
log.info("Try to recover quiz data for Moodle quiz with internal identifier: {}", externalId);
|
||||||
|
|
||||||
// get additional quiz name attribute
|
// get additional quiz name attribute
|
||||||
final AdditionalAttributeRecord additionalAttribute =
|
final AdditionalAttributeRecord additionalAttribute =
|
||||||
this.additionalAttributeRecordMapper.selectByExample()
|
this.additionalAttributeRecordMapper.selectByExample()
|
||||||
|
@ -841,9 +844,15 @@ public class ExamDAOImpl implements ExamDAO {
|
||||||
.findAny()
|
.findAny()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (additionalAttribute != null) {
|
if (additionalAttribute != null) {
|
||||||
|
|
||||||
|
log.debug("Found additional quiz name attribute: {}", additionalAttribute);
|
||||||
|
|
||||||
// get the course name identifier
|
// get the course name identifier
|
||||||
final String shortname = MoodleCourseAccess.getShortname(externalId);
|
final String shortname = MoodleCourseAccess.getShortname(externalId);
|
||||||
if (StringUtils.isNotBlank(shortname)) {
|
if (StringUtils.isNotBlank(shortname)) {
|
||||||
|
|
||||||
|
log.debug("using shortame: {} for recovering", shortname);
|
||||||
|
|
||||||
final QuizData recoveredQuizData = quizzes.entrySet()
|
final QuizData recoveredQuizData = quizzes.entrySet()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(quizEntry -> {
|
.filter(quizEntry -> {
|
||||||
|
@ -855,6 +864,9 @@ public class ExamDAOImpl implements ExamDAO {
|
||||||
.findAny()
|
.findAny()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
if (recoveredQuizData != null) {
|
if (recoveredQuizData != null) {
|
||||||
|
|
||||||
|
log.debug("found quiz data for recovering: {}", recoveredQuizData);
|
||||||
|
|
||||||
// save exam with new external id
|
// save exam with new external id
|
||||||
this.examRecordMapper.updateByPrimaryKeySelective(new ExamRecord(
|
this.examRecordMapper.updateByPrimaryKeySelective(new ExamRecord(
|
||||||
record.getId(),
|
record.getId(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue