Fix js unit test

This commit is contained in:
Daniel Egger 2023-04-05 21:28:40 +02:00
parent 6745431f17
commit f2c6153343
1 changed files with 4 additions and 1 deletions

View File

@ -18,6 +18,9 @@ export interface ContinueData {
}
function getLastCompleted(courseSlug: string, completionData: CourseCompletion[]) {
if (completionData.length === 0) {
return undefined;
}
const courseSessionsStore = useCourseSessionsStore();
const courseSession = courseSessionsStore.courseSessionForCourse(courseSlug);
return orderBy(completionData, ["updated_at"], "desc").find((c: CourseCompletion) => {
@ -79,7 +82,7 @@ export class LearningPath implements WagtailLearningPath {
}
if (page.type === "learnpath.Circle") {
const circle = Circle.fromJson(page, this);
if (completionData) {
if (completionData && completionData.length > 0) {
circle.parseCompletionData(completionData);
}
if (topic) {