fix: use login_id as student id

This commit is contained in:
张泊明518370910136 2022-09-17 17:14:05 +08:00
parent 3d6462aec7
commit 32e35bc919
No known key found for this signature in database
GPG Key ID: FBEF5DE8B9F4C629

View File

@ -27,7 +27,7 @@ class Canvas:
# types = ["student", "observer"] # types = ["student", "observer"]
types = ["student"] types = ["student"]
self.students = self.course.get_users(enrollment_type=types, include=["email"]) self.students = self.course.get_users(enrollment_type=types, include=["email"])
for attr in ["sis_login_id", "sortable_name", "name"]: for attr in ["login_id", "sortable_name", "name"]:
if not hasattr(self.students[0], attr): if not hasattr(self.students[0], attr):
raise Exception( raise Exception(
f"Unable to gather students' {attr}, please contact the Canvas site admin" f"Unable to gather students' {attr}, please contact the Canvas site admin"
@ -129,7 +129,7 @@ class Canvas:
if student is None: if student is None:
continue continue
grade_file_path = os.path.join( grade_file_path = os.path.join(
assignments_dir, student.sis_login_id, self.grade_filename assignments_dir, student.login_id, self.grade_filename
) )
try: try:
grade, *comments = list(open(grade_file_path)) grade, *comments = list(open(grade_file_path))