SEBSERV-464 fixed

This commit is contained in:
anhefti 2023-09-28 17:14:05 +02:00
parent 460f0483ca
commit 77e8618975
2 changed files with 12 additions and 2 deletions

View file

@ -536,6 +536,10 @@ public class MoodlePluginCourseAccess extends AbstractCachedCourseAccess impleme
lmsSetup); lmsSetup);
} }
final Set<String> qIdSet = internalIds.stream()
.map(MoodleUtils::getQuizId)
.collect(Collectors.toSet());
return getCoursesForIds(restTemplate, moodleCourseIds) return getCoursesForIds(restTemplate, moodleCourseIds)
.stream() .stream()
.filter(courseData -> !courseData.quizzes.isEmpty()) .filter(courseData -> !courseData.quizzes.isEmpty())
@ -545,7 +549,7 @@ public class MoodlePluginCourseAccess extends AbstractCachedCourseAccess impleme
urlPrefix, urlPrefix,
this.prependShortCourseName) this.prependShortCourseName)
.stream() .stream()
.filter(q -> internalIds.contains(q.id))) .filter(q -> qIdSet.contains(MoodleUtils.getQuizId(q.id))))
.collect(Collectors.toList()); .collect(Collectors.toList());
} catch (final Exception e) { } catch (final Exception e) {

View file

@ -356,7 +356,8 @@ class ExamUpdateHandler {
!Objects.equals(exam.startTime, quizData.startTime) || !Objects.equals(exam.startTime, quizData.startTime) ||
!Objects.equals(exam.endTime, quizData.endTime) || !Objects.equals(exam.endTime, quizData.endTime) ||
!Utils.isEqualsWithEmptyCheckTruncated(exam.getDescription(), quizData.description) || !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)) { if (!Utils.isEqualsWithEmptyCheck(exam.name, quizData.name)) {
log.info("Update name difference from LMS. Exam: {}, QuizData: {}", 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(), exam.getStartURL(),
quizData.startURL); quizData.startURL);
} }
if (exam.externalId.equals(quizData.id)) {
log.info("Update quizId difference from LMS. Exam:{}, QuizData: {}",
exam.externalId,
quizData.id);
}
return true; return true;
} }