Add tutorial completion tracking to avoid showing tutorial across multiple cities #3837
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #3720
Problem - Users needed to complete the tutorial for every different city they used
Solution-
tutorial_completedboolean column to thesidewalk_usertableDBUsermodel to includetutorialCompletedfield with default value of falsehasCompletedAuditOnboardingmethod to check the user'stutorialCompletedflag instead of searching through missionsmarkTutorialCompletedmethod to set the flag when a user completes the tutorialupdateCompletemethod to automatically mark the tutorial as completed when a user completes an onboarding missionBefore/After screenshots (if applicable)
Testing instructions
Testing this feature is a little tedious, when I was testing it I created a new user, completed the tutorial in once city, and then loaded up another city.
It was important for the new city (the second one you're loading) to have been created before the first one, so you don't need to run
make import-usersagain. See "setting up another city" in the dev environment documentation.make ssh target=db.psql -d sidewalk -U <database user>.SELECT user_id, username, email FROM sidewalk_user WHERE username = '<dummy username you created>'to get your user ID.SELECT user_id, username, tutorial_completed FROM sidewalk_user WHERE user_id = <user id>;.tutorial_completedcolumn is false.Things to check before submitting the PR