Skip to content

Commit 9d6efc8

Browse files
committed
TCA-1102 add ordering to course modules
1 parent c167986 commit 9d6efc8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src-ts/tools/learn/course-details/course-curriculum/CourseCurriculum.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { noop } from 'lodash'
22
import { Dispatch, FC, SetStateAction, useCallback, useEffect, useState } from 'react'
33
import { NavigateFunction, useNavigate, useSearchParams } from 'react-router-dom'
4-
import classNames from 'classnames'
54

6-
import { Button, UserProfile } from '../../../../lib'
5+
import { UserProfile } from '../../../../lib'
76
import {
87
CourseOutline,
98
LearnCourse,

src-ts/tools/learn/learn-lib/data-providers/courses-provider/courses.provider.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,13 @@ export function useGetCourses(
2424

2525
const { data, error }: SWRResponse<ReadonlyArray<LearnCourse>> = useSWR(url, swrCacheConfig)
2626

27+
const course: LearnCourse | undefined = get(data, [0])
28+
29+
// sort modules by order property
30+
course?.modules.sort((mA, mB) => mA.order - mB.order)
31+
2732
return {
28-
course: get(data, [0]),
33+
course,
2934
loading: !data && !error,
3035
ready: !!data || !!error,
3136
}

0 commit comments

Comments
 (0)