Skip to content

Commit 2b2ded6

Browse files
Merge branch 'dev' into PROD-3115_uni-nav
2 parents a471b12 + 83f8a8d commit 2b2ded6

File tree

6 files changed

+39
-13
lines changed

6 files changed

+39
-13
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ install_dependency: &install_dependency
2828
install_deploysuite: &install_deploysuite
2929
name: Installation of install_deploysuite.
3030
command: |
31-
git clone --branch v1.4.12 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
31+
git clone --branch v1.4.13 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
3232
cp ./../buildscript/master_deploy.sh .
3333
cp ./../buildscript/buildenv.sh .
3434
cp ./../buildscript/awsconfiguration.sh .
@@ -184,7 +184,7 @@ jobs:
184184
environment:
185185
DEPLOY_ENV: "PROD"
186186
LOGICAL_ENV: "prod"
187-
ENABLE_CACHE: false
187+
ENABLE_CACHE: true
188188
APPNAME: "platform-ui-mvp"
189189
steps: *deploy_steps
190190

src-ts/tools/learn/course-details/CourseDetailsPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const CourseDetailsPage: FC<{}> = () => {
4848
const {
4949
certificationProgress: progress,
5050
ready: progressReady,
51+
setCertificateProgress,
5152
}: UserCertificationProgressProviderData = useGetUserCertificationProgress(
5253
profile?.userId,
5354
routeParams.provider,
@@ -214,6 +215,7 @@ const CourseDetailsPage: FC<{}> = () => {
214215
progress={progress}
215216
progressReady={progressReady}
216217
profile={profile}
218+
setCertificateProgress={setCertificateProgress}
217219
/>
218220
</div>
219221
</div>

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface CourseCurriculumProps {
3131
profile?: UserProfile
3232
progress?: LearnUserCertificationProgress
3333
progressReady?: boolean
34+
setCertificateProgress: (d: LearnUserCertificationProgress) => void
3435
}
3536

3637
const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProps) => {
@@ -108,7 +109,7 @@ const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProp
108109
}
109110

110111
if (!props.progress?.id) {
111-
await userCertificationProgressStartAsync(
112+
const progress: LearnUserCertificationProgress = await userCertificationProgressStartAsync(
112113
props.profile.userId,
113114
props.course.certificationId,
114115
props.course.id,
@@ -117,6 +118,9 @@ const CourseCurriculum: FC<CourseCurriculumProps> = (props: CourseCurriculumProp
117118
module: props.course.modules[0].meta.dashedName,
118119
},
119120
)
121+
122+
// update progress with data returned from calling the start progress endpoint
123+
props.setCertificateProgress(progress)
120124
} else {
121125
await userCertificationProgressUpdateAsync(
122126
props.progress.id,

src-ts/tools/learn/free-code-camp/FreeCodeCamp.tsx

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { FccFrame } from './fcc-frame'
4545
import { FccSidebar } from './fcc-sidebar'
4646
import { TitleNav } from './title-nav'
4747
import styles from './FreeCodeCamp.module.scss'
48+
import { debounce } from 'lodash'
4849

4950
const FreeCodeCamp: FC<{}> = () => {
5051

@@ -211,7 +212,7 @@ const FreeCodeCamp: FC<{}> = () => {
211212
profile?.userId,
212213
])
213214

214-
const handleFccLessonComplete: (challengeUuid: string) => void = useCallback((challengeUuid: string) => {
215+
const handleFccLessonComplete: (challengeUuid: string) => void = useCallback(debounce((challengeUuid: string) => {
215216

216217
const currentLesson: { [key: string]: string } = {
217218
lesson: lessonParam,
@@ -239,7 +240,7 @@ const FreeCodeCamp: FC<{}> = () => {
239240

240241
})
241242
// eslint-disable-next-line react-hooks/exhaustive-deps
242-
}, [
243+
}, 30), [
243244
certificateProgress,
244245
lessonParam,
245246
moduleParam,
@@ -271,23 +272,40 @@ const FreeCodeCamp: FC<{}> = () => {
271272
return
272273
}
273274

274-
// this is the last lesson to be completed in the first module completed,
275-
// so it's good to show the trigger
276-
surveyTriggerForUser('TCA First Module Completed', profile?.userId)
275+
// This is the last lesson to be completed in the first module completed,
276+
// so it's time to trigger the survey
277+
const surveyTrigger: string = 'TCA First Module Completed'
278+
279+
// If there is only one assessment in a cert (e.g. Data Analysis w/Python),
280+
// the cert is also completed, which redirects the user to the cert page.
281+
// So the survey needs to be delayed so that it appears on the completed
282+
// cert page instead of the current lesson.
283+
284+
// NOTE: we can't use the cert's status here bc it doesn't get set to
285+
// completed until the UI notices the cert is complete and initiates
286+
// the completion. And we have to use >= instead of === because it's
287+
// possible TCA data isn't in sync w/the latest FCC curriculum.
288+
if (progress.certificationProgressPercentage >= 100) {
289+
setTimeout(async () => {
290+
surveyTriggerForUser(surveyTrigger, profile?.userId)
291+
}, 1000)
292+
} else {
293+
surveyTriggerForUser(surveyTrigger, profile?.userId)
294+
}
277295
}
278296

279297
/**
280298
* Handle the navigation away from the last step of the course in the FCC frame
281299
* @returns
282300
*/
283-
const handleFccLastLessonNavigation: () => void = useCallback(() => {
301+
const handleFccLastLessonNavigation: () => void = useCallback(debounce(() => {
284302

285303
if (!certificateProgress) {
286304
return
287305
}
288306

289307
// course is completed, return user to course completed screen
290-
if (certificateProgress.courseProgressPercentage === 100) {
308+
if (certificateProgress.status === UserCertificationProgressStatus.completed) {
291309
const completedPath: string = getCertificationCompletedPath(
292310
providerParam,
293311
certificationParam,
@@ -326,7 +344,7 @@ const FreeCodeCamp: FC<{}> = () => {
326344

327345
navigate(nextLessonPath)
328346
// eslint-disable-next-line react-hooks/exhaustive-deps
329-
}, [
347+
}, 30), [
330348
certificateProgress,
331349
certificationParam,
332350
courseData?.modules,

src-ts/tools/learn/learn-lib/data-providers/user-certifications-provider/user-certification-progress.provider.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ export function useGetUserCertificationProgress(
2727
isPaused: () => !userId || !certification,
2828
})
2929

30+
const certificationProgress: LearnUserCertificationProgress | undefined = find(data, { certification })
31+
3032
return {
31-
certificationProgress: find(data, { certification }),
33+
certificationProgress,
3234
loading: !!userId && !data && !error,
33-
ready: !userId || data || error,
35+
ready: !userId || !!data || !!error,
3436
refetch: () => mutate(),
3537
setCertificateProgress: progress => mutate([progress]),
3638
}

0 commit comments

Comments
 (0)