Skip to content

Commit 5cf54d1

Browse files
authored
Merge pull request #517 from topcoder-platform/TCA-1033_progress-messages
TCA-1033 - update certification progress in course details page -> dev
2 parents 288d611 + a2dc34f commit 5cf54d1

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src-ts/tools/learn/course-details/tca-certification-banner/TCACertificationBanner.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const TCACertificationBanner: FC<TCACertificationBannerProps> = (props: TCACerti
5858
// Fetch Enrollment status & progress
5959
const {
6060
progress: certifProgress,
61-
ready: certifProgressReady,
6261
}: TCACertificationProgressProviderData = useGetTCACertificationProgress(
6362
props.userId as unknown as string,
6463
certification?.dashedName as string,
@@ -69,9 +68,7 @@ const TCACertificationBanner: FC<TCACertificationBannerProps> = (props: TCACerti
6968
// so we can show their progress even before they enroll with the certification
7069
const {
7170
progresses: certsProgress,
72-
}: UserCertificationsProviderData = useGetUserCertifications('freeCodeCamp', {
73-
enabled: certifProgressReady && !certifProgress,
74-
})
71+
}: UserCertificationsProviderData = useGetUserCertifications('freeCodeCamp')
7572

7673
const progressById: ProgressByIdCollection = useMemo(() => (
7774
certsProgress?.reduce((all, progress) => {
@@ -97,22 +94,21 @@ const TCACertificationBanner: FC<TCACertificationBannerProps> = (props: TCACerti
9794
: certification.certificationResources.filter(d => (
9895
progressById[d.freeCodeCampCertification.fccId]?.status === UserCertificationProgressStatus.completed
9996
)).length
97+
const inProgressCoursesCount: number = certification.certificationResources.filter(d => (
98+
progressById[d.freeCodeCampCertification.fccId]?.status === UserCertificationProgressStatus.inProgress
99+
)).length
100100

101101
if (!completedCoursesCount) {
102-
return certifProgress ? getStatusBox(
102+
return inProgressCoursesCount ? getStatusBox(
103+
<IconOutline.ClockIcon />,
104+
`Good job! You are making progress with ${inProgressCoursesCount} of ${coursesCount} required courses.`,
105+
'green',
106+
) : certifProgress ? getStatusBox(
103107
<IconOutline.DotsCircleHorizontalIcon />,
104108
'Begin working towards earning this Topcoder Certification by starting this course today!',
105109
) : <></>
106110
}
107111

108-
if (completedCoursesCount === 1) {
109-
return getStatusBox(
110-
<IconOutline.ClockIcon />,
111-
`Good job! You are making progress with 1 of ${coursesCount} required courses.`,
112-
'green',
113-
)
114-
}
115-
116112
return getStatusBox(
117113
<IconSolid.CheckCircleIcon />,
118114
`You have completed ${completedCoursesCount} of ${coursesCount} required courses.`,

src-ts/tools/learn/learn-lib/data-providers/tca-certifications-provider/tca-certification-progress/tca-certification-progress.model.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { LearnModelBase } from '../../../functions'
2+
import { UserCertificationProgressStatus } from '../../user-certifications-provider'
23
import { TCACertification } from '../tca-certification.model'
34

45
import { TCAFccCertificationProgress } from './tca-fcc-certification-progress.model'
@@ -17,6 +18,7 @@ export interface TCACertificationProgress extends LearnModelBase {
1718
completedAt: null | Date
1819
certificationProgress: number
1920
resourceProgresses: [{
21+
status: UserCertificationProgressStatus,
2022
fccCertificationProgress: TCAFccCertificationProgress
2123
}]
2224
userHandle: string

0 commit comments

Comments
 (0)