From 69effc0b55e0c785b5d1ac688dd613eba146a744 Mon Sep 17 00:00:00 2001 From: Brooke Date: Wed, 14 Dec 2022 11:43:47 -0800 Subject: [PATCH] TCA-790 assessments add delay --- .../learn/free-code-camp/FreeCodeCamp.tsx | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src-ts/tools/learn/free-code-camp/FreeCodeCamp.tsx b/src-ts/tools/learn/free-code-camp/FreeCodeCamp.tsx index 8a889a015..f56e83ba5 100644 --- a/src-ts/tools/learn/free-code-camp/FreeCodeCamp.tsx +++ b/src-ts/tools/learn/free-code-camp/FreeCodeCamp.tsx @@ -274,24 +274,12 @@ const FreeCodeCamp: FC<{}> = () => { // This is the last lesson to be completed in the first module completed, // so it's time to trigger the survey - const surveyTrigger: string = 'TCA First Module Completed' - - // If there is only one assessment in a cert (e.g. Data Analysis w/Python), - // the cert is also completed, which redirects the user to the cert page. - // So the survey needs to be delayed so that it appears on the completed - // cert page instead of the current lesson. - - // NOTE: we can't use the cert's status here bc it doesn't get set to - // completed until the UI notices the cert is complete and initiates - // the completion. And we have to use >= instead of === because it's - // possible TCA data isn't in sync w/the latest FCC curriculum. - if (progress.certificationProgressPercentage >= 100) { - setTimeout(async () => { - surveyTriggerForUser(surveyTrigger, profile?.userId) - }, 1000) - } else { - surveyTriggerForUser(surveyTrigger, profile?.userId) - } + + // NOTE: We have to add a delay, otherwise the survey closes when the user + // is automatically redirected to the next lesson. + setTimeout(() => { + surveyTriggerForUser('TCA First Module Completed', profile?.userId) + }, 1000) } /**