From d56328ce4a0eed5e7a72843c4560fbb0d6492cc3 Mon Sep 17 00:00:00 2001 From: King <49303317+linsyking@users.noreply.github.com> Date: Sun, 28 May 2023 17:17:50 +0800 Subject: [PATCH] fix: use `integration_id` to get students' jAccount username (#22) --- joint_teapot/workers/gitea.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/joint_teapot/workers/gitea.py b/joint_teapot/workers/gitea.py index 0e2036c..e66286d 100644 --- a/joint_teapot/workers/gitea.py +++ b/joint_teapot/workers/gitea.py @@ -68,9 +68,9 @@ class Gitea: @lru_cache() def _get_username_by_canvas_student(self, student: User) -> str: - if student.email == None or student.email.find("@") == -1: - raise Exception(f"{student} not found in Gitea") - return student.email.split("@")[0] + if student.integration_id is None: + raise Exception(f"{student} id not found in Gitea") + return student.integration_id def add_canvas_students_to_teams( self, students: PaginatedList, team_names: List[str]