Skip to content

TCA-790 Delay survey if the cert is completed -> dev #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src-ts/tools/learn/free-code-camp/FreeCodeCamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,26 @@ const FreeCodeCamp: FC<{}> = () => {
return
}

// this is the last lesson to be completed in the first module completed,
// so it's good to show the trigger
surveyTriggerForUser('TCA First Module Completed', profile?.userId)
// 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)
}
}

/**
Expand Down