fix: use integration_id to get students' jAccount username (#22)

This commit is contained in:
King 2023-05-28 17:17:50 +08:00 committed by GitHub
parent fb2b866667
commit d56328ce4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,9 +68,9 @@ class Gitea:
@lru_cache() @lru_cache()
def _get_username_by_canvas_student(self, student: User) -> str: def _get_username_by_canvas_student(self, student: User) -> str:
if student.email == None or student.email.find("@") == -1: if student.integration_id is None:
raise Exception(f"{student} not found in Gitea") raise Exception(f"{student} id not found in Gitea")
return student.email.split("@")[0] return student.integration_id
def add_canvas_students_to_teams( def add_canvas_students_to_teams(
self, students: PaginatedList, team_names: List[str] self, students: PaginatedList, team_names: List[str]