Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lowrank committed Sep 3, 2024
1 parent eed0842 commit 51717af
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions grader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand All @@ -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')

0 comments on commit 51717af

Please sign in to comment.