From 77e861897534e454c16bea580b1332d5d554d0ca Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 28 Sep 2023 17:14:05 +0200 Subject: [PATCH] SEBSERV-464 fixed --- .../lms/impl/moodle/plugin/MoodlePluginCourseAccess.java | 6 +++++- .../servicelayer/session/impl/ExamUpdateHandler.java | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/plugin/MoodlePluginCourseAccess.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/plugin/MoodlePluginCourseAccess.java index a5505674..20a5b5cb 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/plugin/MoodlePluginCourseAccess.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/moodle/plugin/MoodlePluginCourseAccess.java @@ -536,6 +536,10 @@ public class MoodlePluginCourseAccess extends AbstractCachedCourseAccess impleme lmsSetup); } + final Set qIdSet = internalIds.stream() + .map(MoodleUtils::getQuizId) + .collect(Collectors.toSet()); + return getCoursesForIds(restTemplate, moodleCourseIds) .stream() .filter(courseData -> !courseData.quizzes.isEmpty()) @@ -545,7 +549,7 @@ public class MoodlePluginCourseAccess extends AbstractCachedCourseAccess impleme urlPrefix, this.prependShortCourseName) .stream() - .filter(q -> internalIds.contains(q.id))) + .filter(q -> qIdSet.contains(MoodleUtils.getQuizId(q.id)))) .collect(Collectors.toList()); } catch (final Exception 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 033e7e5f..1ab751a3 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 @@ -356,7 +356,8 @@ class ExamUpdateHandler { !Objects.equals(exam.startTime, quizData.startTime) || !Objects.equals(exam.endTime, quizData.endTime) || !Utils.isEqualsWithEmptyCheckTruncated(exam.getDescription(), quizData.description) || - !Utils.isEqualsWithEmptyCheck(exam.getStartURL(), quizData.startURL)) { + !Utils.isEqualsWithEmptyCheck(exam.getStartURL(), quizData.startURL) || + !exam.externalId.equals(quizData.id)) { if (!Utils.isEqualsWithEmptyCheck(exam.name, quizData.name)) { log.info("Update name difference from LMS. Exam: {}, QuizData: {}", exam.name, quizData.name); @@ -376,6 +377,11 @@ class ExamUpdateHandler { exam.getStartURL(), quizData.startURL); } + if (exam.externalId.equals(quizData.id)) { + log.info("Update quizId difference from LMS. Exam:{}, QuizData: {}", + exam.externalId, + quizData.id); + } return true; }