Skip to content

Commit 8e409b0

Browse files
Merge branch 'dev' into TCA-499_eslint
2 parents 946a90e + fdec5fb commit 8e409b0

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

src-ts/tools/learn/learn-lib/course-outline/collapsible-item/CollapsibleItem.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { Link } from 'react-router-dom'
33
import classNames from 'classnames'
44

55
import { IconOutline, IconSolid } from '../../../../../lib'
6-
import { LearnModule, LearnModuleProgress, LearnUserCertificationProgress } from '../..'
6+
import {
7+
LearnModule,
8+
LearnModuleProgress,
9+
LearnModuleStatus,
10+
LearnUserCertificationProgress,
11+
} from '../..'
712
import { StatusIcon } from '../status-icon'
813
import { StepIcon } from '../step-icon'
914

@@ -43,16 +48,11 @@ const CollapsibleItem: FC<CollapsibleItemProps> = (props: CollapsibleItemProps)
4348
props.progress?.find(m => m.module === props.moduleKey)
4449
), [props.progress, props.moduleKey])
4550

46-
const isCompleted: boolean = useMemo(() => (
47-
!!progress && progress.lessonCount === progress?.completedLessons.length
48-
), [progress])
49-
50-
const isPartial: boolean = useMemo(() => (
51-
!!progress && !!progress.completedLessons.length
52-
), [progress])
51+
const isPartial: boolean = useMemo(() => !!progress && !!progress.completedLessons.length, [progress])
5352

5453
const isItemCompleted: (key: string) => boolean = (key: string) => (
55-
!!progress?.completedLessons.find(l => l.dashedName === key)
54+
progress?.moduleStatus === LearnModuleStatus.completed
55+
|| !!progress?.completedLessons.find(l => l.dashedName === key)
5656
)
5757

5858
const stepLabel: (
@@ -95,7 +95,7 @@ const CollapsibleItem: FC<CollapsibleItemProps> = (props: CollapsibleItemProps)
9595
return (
9696
<div className={classNames(styles.wrap, isOpen ? 'is-open' : 'collapsed')}>
9797
<div className={styles['title-row']} onClick={toggle}>
98-
<StatusIcon completed={isCompleted} partial={isPartial} />
98+
<StatusIcon completed={progress?.moduleStatus === LearnModuleStatus.completed} partial={isPartial} />
9999
<span className={styles.title}>
100100
{props.isAssessment && (
101101
<div className={classNames(styles['title-tag'], 'label')}>

src-ts/tools/learn/learn-lib/data-providers/user-certifications-provider/user-certifications-functions/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from './learn-user-certification-progress.model'
22
export * from './learn-module-progress.model'
3+
export * from './learn-module-status.enum'
34
export * from './user-certification-progress-status.enum'
45
export * from './user-certification-update-progress-actions.enum'
56
export {

src-ts/tools/learn/learn-lib/data-providers/user-certifications-provider/user-certifications-functions/learn-module-progress.model.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export interface LearnModuleProgress {
44
dashedName: string
55
}>
66
completedPercentage: number
7-
lessonCount: number
87
module: string
98
moduleStatus: string
109
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export enum LearnModuleStatus {
2+
init = 'not-started',
3+
inProgress = 'in-progress',
4+
completed = 'completed',
5+
}

0 commit comments

Comments
 (0)