Skip to content

Commit fdec5fb

Browse files
authored
Merge pull request #412 from topcoder-platform/TCA-658_module-status
TCA-658 - use module.status to show a module as completed -> dev
2 parents 54c791e + 0bcd1d0 commit fdec5fb

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { Dispatch, FC, ReactNode, SetStateAction, useCallback, useMemo, useState
33
import { Link } from 'react-router-dom'
44

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

@@ -40,15 +45,12 @@ const CollapsibleItem: FC<CollapsibleItemProps> = (props: CollapsibleItemProps)
4045
return props.progress?.find(m => m.module === props.moduleKey)
4146
}, [props.progress, props.moduleKey])
4247

43-
const isCompleted: boolean = useMemo(() => {
44-
return !!progress && progress.lessonCount === progress?.completedLessons.length
45-
}, [progress])
46-
4748
const isPartial: boolean = useMemo(() => {
4849
return !!progress && !!progress.completedLessons.length
4950
}, [progress])
5051

5152
const isItemCompleted: (key: string) => boolean = (key: string) => (
53+
progress?.moduleStatus === LearnModuleStatus.completed ||
5254
!!progress?.completedLessons.find(l => l.dashedName === key)
5355
)
5456

@@ -86,7 +88,7 @@ const CollapsibleItem: FC<CollapsibleItemProps> = (props: CollapsibleItemProps)
8688
return (
8789
<div className={classNames(styles['wrap'], isOpen ? 'is-open' : 'collapsed')}>
8890
<div className={styles['title-row']} onClick={toggle}>
89-
<StatusIcon completed={isCompleted} partial={isPartial} />
91+
<StatusIcon completed={progress?.moduleStatus === LearnModuleStatus.completed} partial={isPartial} />
9092
<span className={styles['title']}>
9193
{props.isAssessment && (
9294
<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)