File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
lib/functions/survey-functions
tools/learn/free-code-camp Expand file tree Collapse file tree 2 files changed +20
-3
lines changed File renamed without changes.
Original file line number Diff line number Diff line change @@ -271,9 +271,26 @@ const FreeCodeCamp: FC<{}> = () => {
271
271
return
272
272
}
273
273
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
+ const surveyTrigger : string = 'TCA First Module Completed'
277
+
278
+ // If there is only one assessment in a cert (e.g. Data Analysis w/Python),
279
+ // the cert is also completed, which redirects the user to the cert page.
280
+ // So the survey needs to be delayed so that it appears on the completed
281
+ // cert page instead of the current lesson.
282
+
283
+ // NOTE: we can't use the cert's status here bc it doesn't get set to
284
+ // completed until the UI notices the cert is complete and initiates
285
+ // the completion. And we have to use >= instead of === because it's
286
+ // possible TCA data isn't in sync w/the latest FCC curriculum.
287
+ if ( progress . certificationProgressPercentage >= 100 ) {
288
+ setTimeout ( async ( ) => {
289
+ surveyTriggerForUser ( surveyTrigger , profile ?. userId )
290
+ } , 1000 )
291
+ } else {
292
+ surveyTriggerForUser ( surveyTrigger , profile ?. userId )
293
+ }
277
294
}
278
295
279
296
/**
You can’t perform that action at this time.
0 commit comments