Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const TCACertificationBanner: FC<TCACertificationBannerProps> = (props: TCACerti
// Fetch Enrollment status & progress
const {
progress: certifProgress,
ready: certifProgressReady,
}: TCACertificationProgressProviderData = useGetTCACertificationProgress(
props.userId as unknown as string,
certification?.dashedName as string,
Expand All @@ -69,9 +68,7 @@ const TCACertificationBanner: FC<TCACertificationBannerProps> = (props: TCACerti
// so we can show their progress even before they enroll with the certification
const {
progresses: certsProgress,
}: UserCertificationsProviderData = useGetUserCertifications('freeCodeCamp', {
enabled: certifProgressReady && !certifProgress,
})
}: UserCertificationsProviderData = useGetUserCertifications('freeCodeCamp')

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

if (!completedCoursesCount) {
return certifProgress ? getStatusBox(
return inProgressCoursesCount ? getStatusBox(
<IconOutline.ClockIcon />,
`Good job! You are making progress with ${inProgressCoursesCount} of ${coursesCount} required courses.`,
'green',
) : certifProgress ? getStatusBox(
<IconOutline.DotsCircleHorizontalIcon />,
'Begin working towards earning this Topcoder Certification by starting this course today!',
) : <></>
}

if (completedCoursesCount === 1) {
return getStatusBox(
<IconOutline.ClockIcon />,
`Good job! You are making progress with 1 of ${coursesCount} required courses.`,
'green',
)
}

return getStatusBox(
<IconSolid.CheckCircleIcon />,
`You have completed ${completedCoursesCount} of ${coursesCount} required courses.`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { LearnModelBase } from '../../../functions'
import { UserCertificationProgressStatus } from '../../user-certifications-provider'
import { TCACertification } from '../tca-certification.model'

import { TCAFccCertificationProgress } from './tca-fcc-certification-progress.model'
Expand All @@ -17,6 +18,7 @@ export interface TCACertificationProgress extends LearnModelBase {
completedAt: null | Date
certificationProgress: number
resourceProgresses: [{
status: UserCertificationProgressStatus,
fccCertificationProgress: TCAFccCertificationProgress
}]
userHandle: string
Expand Down