Skip to content

Commit 8c10a2c

Browse files
TCA-790 #comment add delay if the cert is completed #time 2h
1 parent 9fc1e01 commit 8c10a2c

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,17 @@ const FreeCodeCamp: FC<{}> = () => {
271271
return
272272
}
273273

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)
274+
// This is the last lesson to be completed in the first module completed,
275+
// so it's time to trigger the survey
276+
277+
// If there is only one assessment in a cert (e.g. Data Analysis w/Python),
278+
// the cert is also completed, which redirects the user to the cert page.
279+
// So the survey needs to be delayed so that it appears on the completed
280+
// cert page instead of the current lesson.
281+
const delay: number = progress.status === UserCertificationProgressStatus.completed ? 3000 : 0
282+
setTimeout(async () => {
283+
surveyTriggerForUser('TCA First Module Completed', profile?.userId)
284+
}, delay)
277285
}
278286

279287
/**

0 commit comments

Comments
 (0)