Skip to content

Commit a5788de

Browse files
TCA-663 Delay survey
1 parent 83f8a8d commit a5788de

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

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

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { debounce } from 'lodash'
12
import {
23
Dispatch,
34
FC,
@@ -45,7 +46,6 @@ import { FccFrame } from './fcc-frame'
4546
import { FccSidebar } from './fcc-sidebar'
4647
import { TitleNav } from './title-nav'
4748
import styles from './FreeCodeCamp.module.scss'
48-
import { debounce } from 'lodash'
4949

5050
const FreeCodeCamp: FC<{}> = () => {
5151

@@ -274,24 +274,11 @@ const FreeCodeCamp: FC<{}> = () => {
274274

275275
// This is the last lesson to be completed in the first module completed,
276276
// 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-
}
277+
278+
// NOTE: We have to add a delay, otherwise the survey closes when the user
279+
// is automatically redirected to the next lesson.
280+
surveyTriggerForUser('TCA First Module Completed', profile?.userId)
281+
295282
}
296283

297284
/**

0 commit comments

Comments
 (0)