Skip to content

Commit a3b577d

Browse files
committed
Rename find_owner method to find_user_account_for_proposed_owner
1 parent 62710ab commit a3b577d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/jobs/school_import_job.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ def store_results(results, user_id)
3939
end
4040

4141
def import_school(school_data)
42-
owner = find_owner(school_data[:owner_email])
42+
proposed_owner = find_user_account_for_proposed_owner(school_data[:owner_email])
4343

44-
unless owner
44+
unless proposed_owner
4545
@results[:failed] << {
4646
name: school_data[:name],
4747
error_code: SchoolImportError::CODES[:owner_not_found],
@@ -52,7 +52,7 @@ def import_school(school_data)
5252
end
5353

5454
# Check if this owner already has any role in any school
55-
existing_role = Role.find_by(user_id: owner[:id])
55+
existing_role = Role.find_by(user_id: proposed_owner[:id])
5656
if existing_role
5757
existing_school = existing_role.school
5858
@results[:failed] << {
@@ -71,7 +71,7 @@ def import_school(school_data)
7171
School.transaction do
7272
result = School::Create.call(
7373
school_params: school_params,
74-
creator_id: owner[:id]
74+
creator_id: proposed_owner[:id]
7575
)
7676

7777
if result.success?
@@ -105,7 +105,7 @@ def import_school(school_data)
105105
Sentry.capture_exception(e)
106106
end
107107

108-
def find_owner(email)
108+
def find_user_account_for_proposed_owner(email)
109109
return nil if email.blank?
110110

111111
UserInfoApiClient.find_user_by_email(email)

0 commit comments

Comments
 (0)