Fix cypress tests
This commit is contained in:
parent
85a0ba1d25
commit
1fdabf77c0
|
|
@ -1,6 +1,7 @@
|
|||
import orderBy from "lodash/orderBy";
|
||||
|
||||
import { Circle } from "@/services/circle";
|
||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||
import { useLearningPathStore } from "@/stores/learningPath";
|
||||
import type {
|
||||
Course,
|
||||
|
|
@ -16,11 +17,13 @@ export interface ContinueData {
|
|||
has_no_progress: boolean;
|
||||
}
|
||||
|
||||
function getLastCompleted(courseId: number, completionData: CourseCompletion[]) {
|
||||
function getLastCompleted(courseSlug: string, completionData: CourseCompletion[]) {
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const courseSession = courseSessionsStore.courseSessionForCourse(courseSlug);
|
||||
return orderBy(completionData, ["updated_at"], "desc").find((c: CourseCompletion) => {
|
||||
return (
|
||||
c.completion_status === "success" &&
|
||||
c.course === courseId &&
|
||||
c.course_session === courseSession?.id &&
|
||||
c.page_type === "learnpath.LearningContent"
|
||||
);
|
||||
});
|
||||
|
|
@ -115,7 +118,7 @@ export class LearningPath implements WagtailLearningPath {
|
|||
this.nextLearningContent = undefined;
|
||||
|
||||
const lastCompletedLearningContent = getLastCompleted(
|
||||
this.course.id,
|
||||
this.course.slug,
|
||||
completionData
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ export interface CourseCompletion {
|
|||
page_key: string;
|
||||
page_type: string;
|
||||
page_slug: string;
|
||||
course: number;
|
||||
course_session: number;
|
||||
completion_status: CourseCompletionStatus;
|
||||
additional_json_data: unknown;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import mitt from "mitt";
|
||||
|
||||
export type MittEvents = {
|
||||
// FIXME:
|
||||
switchedCourseSession: number;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue