This commit is contained in:
anhefti 2020-12-09 08:23:27 +01:00
parent bbf241b08e
commit 03563a50ed

View file

@ -267,6 +267,8 @@ public class MoodleCourseAccess extends CourseAccess {
courseKeyPageJSON, courseKeyPageJSON,
CoursePage.class); CoursePage.class);
log.info("Got course page with: {} items", keysPage.courseKeys.size());
// get courses // get courses
final Set<String> ids = keysPage.courseKeys final Set<String> ids = keysPage.courseKeys
.stream() .stream()
@ -274,7 +276,7 @@ public class MoodleCourseAccess extends CourseAccess {
.collect(Collectors.toSet()); .collect(Collectors.toSet());
final long now = DateTime.now(DateTimeZone.UTC).getMillis(); final long now = DateTime.now(DateTimeZone.UTC).getMillis();
return getCoursesForIds(restTemplate, ids) final Collection<CourseData> result = getCoursesForIds(restTemplate, ids)
.stream() .stream()
.filter(course -> course.time_created == null .filter(course -> course.time_created == null
|| course.time_created.longValue() > aYearAgo || course.time_created.longValue() > aYearAgo
@ -282,6 +284,10 @@ public class MoodleCourseAccess extends CourseAccess {
|| (course.end_date <= 0 || (course.end_date <= 0
|| course.end_date > now))) || course.end_date > now)))
.collect(Collectors.toList()); .collect(Collectors.toList());
log.info("After filtering {} left", result.size());
return result;
} catch (final Exception e) { } catch (final Exception e) {
log.error("Unexpected error while trying to get courses page: ", e); log.error("Unexpected error while trying to get courses page: ", e);
return Collections.emptyList(); return Collections.emptyList();