diff --git a/grader.py b/grader.py index b71bb08..26884d3 100644 --- a/grader.py +++ b/grader.py @@ -155,11 +155,14 @@ def grade(self, hw_str='hw00', output_file='grades.csv'): student_dir = os.path.join(self.submission_dir, Path(student_file).stem) unzip(student_file, student_dir) + name = Path(student_file).stem[0:15] + matlab_cnt_passes = 0 python_cnt_passes = 0 email = '' - if os.path.exists(os.path.join(student_dir, hw_str + '.m')) or os.path.exists(os.path.join(student_dir, hw_str + '.py')): + if os.path.exists(os.path.join(student_dir, hw_str + '.m')) or\ + os.path.exists(os.path.join(student_dir, hw_str + '.py')): if os.path.exists(os.path.join(student_dir, hw_str + '.m')): matlab_cnt_passes, matlab_email = self.matlab_grade(student_dir, hw_str) if len(matlab_email) > 0 or matlab_cnt_passes > 0: @@ -170,8 +173,7 @@ def grade(self, hw_str='hw00', output_file='grades.csv'): f'Student {(i+1): 3d}/{total_students: 3d}\ scored: {matlab_cnt_passes} | {student_dir} \n') grades_file.write( - f'{Path(student_file).stem[0:15]}, {email}, {student_code}, {matlab_cnt_passes}\n') - + f'{name}, {email}, {student_code}, {matlab_cnt_passes}\n') if os.path.exists(os.path.join(student_dir, hw_str + '.py')): python_cnt_passes, python_email = self.python_grade(student_dir, hw_str) @@ -183,9 +185,9 @@ def grade(self, hw_str='hw00', output_file='grades.csv'): f'Student {(i+1): 3d}/{total_students: 3d}\ scored: {python_cnt_passes} | {student_dir} \n') grades_file.write( - f'{Path(student_file).stem[0:15]}, {email}, {student_code}, {python_cnt_passes}\n') + f'{name}, {email}, {student_code}, {python_cnt_passes}\n') else: student_code = 'other' - grades_file.write(f'{Path(student_file).stem[0:15]}, , ,\n') + grades_file.write(f'{name}, , ,\n') \ No newline at end of file