-
Notifications
You must be signed in to change notification settings - Fork 5
1069-add-immediate-onboarding #640
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
Open
danhalson
wants to merge
16
commits into
main
Choose a base branch
from
1069-add-immediate-onboarding
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+489
−173
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
014c32a
1069: Add immediate onboarding
danhalson cfd9679
Use describe for rubocop
danhalson e772282
1069: Add error_type to duplication response
danhalson 40ff100
1069: Descoped duplication
danhalson 3d2c773
1069: Update flag usage
danhalson c3d6018
1069: Ensure old coverage exists until feature flag removed
danhalson e93a856
1069: Comment what needs to be removed once the flag is retired
danhalson 5ad7647
1069: Ensure we're rolling back based on the result of onboarding to …
danhalson 9741bb7
1069: Fix test failure
danhalson 12f5e0a
Bring schema version up to date
danhalson 35bcce7
Update schools_controller.rb
danhalson afe2d63
Create the code after_create to ensure it rolls back the transaction …
danhalson bf3c6b6
Ensure we're using the same country_code
danhalson 8978fe3
Ensure we raise if onboarding was to fail for any reason
danhalson 8f4804c
1069: Fix quotes
danhalson 96d14f8
1069: Add coverage to ensure the SchoolOnboardingService is called / …
danhalson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| class SchoolOnboardingService | ||
| attr_reader :school | ||
|
|
||
| def initialize(school) | ||
| @school = school | ||
| end | ||
|
|
||
| def onboard(token:) | ||
| School.transaction do | ||
| Role.owner.create!(user_id: school.creator_id, school:) | ||
| Role.teacher.create!(user_id: school.creator_id, school:) | ||
|
|
||
| ProfileApiClient.create_school(token:, id: school.id, code: school.code) | ||
| end | ||
| rescue StandardError => e | ||
| Sentry.capture_exception(e) | ||
| Rails.logger.error { "Failed to onboard school #{@school.id}: #{e.message}" } | ||
| false | ||
| else | ||
| true | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module FeatureFlags | ||
| def self.immediate_school_onboarding? | ||
| ENV['ENABLE_IMMEDIATE_SCHOOL_ONBOARDING'] == 'true' | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.