Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit 955eb89

Browse files
committed
BulkImport: default to teacher email if parent email fails validation
1 parent 600edab commit 955eb89

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

CodeChallenge/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,12 @@ def generate_user_from_row(self, row_num: int, row: List[str]):
678678
self.import_error(row_num, "Failed validation: " + str(e))
679679
return
680680
except UndeliverableEmail:
681-
self.import_error(row_num, "Cannot deliver to this email address.")
682-
return
681+
# default to the teacher's email in case they gave us a bad parent email
682+
user.set_parent_email(teacher_email)
683+
self.import_error(
684+
row_num,
685+
"User created successfully but parent email was undeliverable. Used teacher email instead.",
686+
)
683687

684688
if type(row[self.DOB]) == str:
685689
user.dob = row[self.DOB]

0 commit comments

Comments
 (0)