Commit 69104f7a authored by Olivier's avatar Olivier
Browse files

M12: deal with single-peer cases, include comments

* When only one peer participated, participant receives one grade only
* Emails include comments from peers
* Better input/output file naming

The code in this commit is contributed by Germán Santa Maria.
parent 49dd47e2
......@@ -23,7 +23,7 @@ Output:
"""-------------------------Hard coded input--------------------------------"""
# Input files paths
input_csv_path = 'script_input/grades_to_send.csv'
solutions_pdfs_path = 'script_input/'
solutions_pdfs_path = 'script_input/pdfs/'
# Output files paths
output_csv_path = 'script_output/sent_emails.csv'
......@@ -70,6 +70,7 @@ peer1_grade4 = []
peer1_grade5 = []
peer1_grade6 = []
peer1_rem_poits = []
peer1_comments = []
peer1_final_grade = []
peer2_grade1 = []
......@@ -79,6 +80,7 @@ peer2_grade4 = []
peer2_grade5 = []
peer2_grade6 = []
peer2_rem_poits = []
peer2_comments = []
peer2_final_grade = []
avg_grade = []
......@@ -101,19 +103,21 @@ with open(input_csv_path, newline='') as f:
peer1_grade5.append(row[11])
peer1_grade6.append(row[12])
peer1_rem_poits.append(row[13])
peer1_final_grade.append(row[14])
peer2_grade1.append(row[15])
peer2_grade2.append(row[16])
peer2_grade3.append(row[17])
peer2_grade4.append(row[18])
peer2_grade5.append(row[19])
peer2_grade6.append(row[20])
peer2_rem_poits.append(row[21])
peer2_final_grade.append(row[22])
avg_grade.append(row[23])
peer1_comments.append(row[14])
peer1_final_grade.append(row[15])
peer2_grade1.append(row[16])
peer2_grade2.append(row[17])
peer2_grade3.append(row[18])
peer2_grade4.append(row[19])
peer2_grade5.append(row[20])
peer2_grade6.append(row[21])
peer2_rem_poits.append(row[22])
peer2_comments.append(row[23])
peer2_final_grade.append(row[24])
avg_grade.append(row[25])
for ID in custom_ID_A:
attachment_name = "Solution_submisison_1_"+ID+".pdf"
attachment_name = "Solution_submission_1_"+ID+".pdf"
attachments.append(attachment_name)
# Make sure that all the attachments are in the script_input folder
......@@ -126,11 +130,40 @@ for i in range(0, len(custom_ID_A)):
"""-----------------Build email text for each student-----------------------"""
# Write a personalized email body for each student
standard_body = """Dear XXstudent_nameXX,
#------------Email body for students with only one peer-----------------------#
standard_body_onepeer = """Dear XXstudent_nameXX,
thank you for grading your peers on this coursework assignment!
Two of your peers graded your work over the week-end. You obtained an average of XXavg_grade2XX / 10 for this assignment. I attach the complete solution to your work, as well as your submisison, so you may compare.
One of your peers graded your work over the week-end — the other peer did not submit their grading assignment in time, so you only receive one mark this time. You obtained XXfinal_gradeXX/10 for this assignment. I attach the complete solution to your assignment, together with your submisison, so you may compare.
The details of the grade are as follows:
Peer 1:
Q1 Is the correct general formula for the answer provided? XXgrade1XX
Q1 Is the correct corresponding calculation provided? XXgrade2XX
Q1 Is a sensible final result provided, expressed with the correct units? XXgrade3XX
Q2 Is the correct general formula for the answer provided? XXgrade4XX
Q2 Is the correct corresponding calculation provided? XXgrade5XX
Q2 Is a sensible final result provided, expressed with the correct units? XXgrade6XX
Points removed because the submission is poorly formatted or poorly organized XXrem_poitsXX
Comments:
XXcommentsXX
(insert email body)
with best regards,
(author)
"""
#-----------------Email body for students with two peers----------------------#
standard_body_twopeers = """Dear XXstudent_nameXX,
thank you for grading your peers on the third coursework assignment!
Two of your peers graded your work over the week-end. You obtained an average of XXavg_grade2XX/10 for this assignment. I attach the complete solution to your assignment, together with your submisison, so you may compare.
The details of the grades are as follows:
Peer 1:
......@@ -141,6 +174,8 @@ Peer 1:
Q2 Is the correct corresponding calculation provided? XXpeer1_grade5XX
Q2 Is a sensible final result provided, expressed with the correct units? XXpeer1_grade6XX
Points removed because the submission is poorly formatted or poorly organized XXpeer1_rem_poitsXX
Comments:
XXpeer1_commentsXX
Peer 2:
Q1 Is the correct general formula for the answer provided? XXpeer2_grade1XX
......@@ -150,8 +185,10 @@ Peer 2:
Q2 Is the correct corresponding calculation provided? XXpeer2_grade5XX
Q2 Is a sensible final result provided, expressed with the correct units? XXpeer2_grade6XX
Points removed because the submission is poorly formatted or poorly organized XXpeer2_rem_poitsXX
Comments:
XXpeer2_commentsXX
As you can see, the average of both grades is XXavg_grade2XX / 10 points
As you can see, the average of both grades is XXavg_grade2XX / 10 points.
(insert email body)
......@@ -161,31 +198,66 @@ with best regards,
"""
for i in range(0, len(names)):
temp_body = standard_body.replace("XXstudent_nameXX", names[i])
temp_body = temp_body.replace("XXpeer1_grade1XX", peer1_grade1[i])
temp_body = temp_body.replace("XXpeer1_grade2XX", peer1_grade2[i])
temp_body = temp_body.replace("XXpeer1_grade3XX", peer1_grade3[i])
temp_body = temp_body.replace("XXpeer1_grade4XX", peer1_grade4[i])
temp_body = temp_body.replace("XXpeer1_grade5XX", peer1_grade5[i])
temp_body = temp_body.replace("XXpeer1_grade6XX", peer1_grade6[i])
temp_body = temp_body.replace("XXpeer1_rem_poitsXX", peer1_rem_poits[i])
temp_body = temp_body.replace("XXpeer1_final_gradeXX", peer1_final_grade[i])
# For students with only one peer
if peer1_grade1[i] == 'None' or peer1_grade1[i] == 'none' or peer1_grade1[i] == 'NONE':
temp_body = standard_body_onepeer.replace("XXstudent_nameXX", names[i])
temp_body = temp_body.replace("XXgrade1XX", peer2_grade1[i])
temp_body = temp_body.replace("XXgrade2XX", peer2_grade2[i])
temp_body = temp_body.replace("XXgrade3XX", peer2_grade3[i])
temp_body = temp_body.replace("XXgrade4XX", peer2_grade4[i])
temp_body = temp_body.replace("XXgrade5XX", peer2_grade5[i])
temp_body = temp_body.replace("XXgrade6XX", peer2_grade6[i])
temp_body = temp_body.replace("XXrem_poitsXX", peer2_rem_poits[i])
temp_body = temp_body.replace("XXcommentsXX", peer2_comments[i])
temp_body = temp_body.replace("XXfinal_gradeXX", peer2_final_grade[i])
temp_body = temp_body.replace("XXpeer2_grade1XX", peer2_grade1[i])
temp_body = temp_body.replace("XXpeer2_grade2XX", peer2_grade2[i])
temp_body = temp_body.replace("XXpeer2_grade3XX", peer2_grade3[i])
temp_body = temp_body.replace("XXpeer2_grade4XX", peer2_grade4[i])
temp_body = temp_body.replace("XXpeer2_grade5XX", peer2_grade5[i])
temp_body = temp_body.replace("XXpeer2_grade6XX", peer2_grade6[i])
temp_body = temp_body.replace("XXpeer2_rem_poitsXX", peer2_rem_poits[i])
temp_body = temp_body.replace("XXpeer2_final_gradeXX", peer2_final_grade[i])
elif peer2_grade1[i] == 'None' or peer2_grade1[i] == 'none' or peer2_grade1[i] == 'NONE':
temp_body = standard_body_onepeer.replace("XXstudent_nameXX", names[i])
temp_body = temp_body.replace("XXgrade1XX", peer1_grade1[i])
temp_body = temp_body.replace("XXgrade2XX", peer1_grade2[i])
temp_body = temp_body.replace("XXgrade3XX", peer1_grade3[i])
temp_body = temp_body.replace("XXgrade4XX", peer1_grade4[i])
temp_body = temp_body.replace("XXgrade5XX", peer1_grade5[i])
temp_body = temp_body.replace("XXgrade6XX", peer1_grade6[i])
temp_body = temp_body.replace("XXrem_poitsXX", peer1_rem_poits[i])
temp_body = temp_body.replace("XXcommentsXX", peer1_comments[i])
temp_body = temp_body.replace("XXfinal_gradeXX", peer1_final_grade[i])
temp_body = temp_body.replace("XXavg_grade2XX", avg_grade[i])
else: # For students with two peers
temp_body = standard_body_twopeers.replace("XXstudent_nameXX", names[i])
temp_body = temp_body.replace("XXpeer1_grade1XX", peer1_grade1[i])
temp_body = temp_body.replace("XXpeer1_grade2XX", peer1_grade2[i])
temp_body = temp_body.replace("XXpeer1_grade3XX", peer1_grade3[i])
temp_body = temp_body.replace("XXpeer1_grade4XX", peer1_grade4[i])
temp_body = temp_body.replace("XXpeer1_grade5XX", peer1_grade5[i])
temp_body = temp_body.replace("XXpeer1_grade6XX", peer1_grade6[i])
temp_body = temp_body.replace("XXpeer1_rem_poitsXX", peer1_rem_poits[i])
temp_body = temp_body.replace("XXpeer1_commentsXX", peer1_comments[i])
temp_body = temp_body.replace("XXpeer1_final_gradeXX", peer1_final_grade[i])
temp_body = temp_body.replace("XXpeer2_grade1XX", peer2_grade1[i])
temp_body = temp_body.replace("XXpeer2_grade2XX", peer2_grade2[i])
temp_body = temp_body.replace("XXpeer2_grade3XX", peer2_grade3[i])
temp_body = temp_body.replace("XXpeer2_grade4XX", peer2_grade4[i])
temp_body = temp_body.replace("XXpeer2_grade5XX", peer2_grade5[i])
temp_body = temp_body.replace("XXpeer2_grade6XX", peer2_grade6[i])
temp_body = temp_body.replace("XXpeer2_rem_poitsXX", peer2_rem_poits[i])
temp_body = temp_body.replace("XXpeer2_commentsXX", peer2_comments[i])
temp_body = temp_body.replace("XXpeer2_final_gradeXX", peer2_final_grade[i])
temp_body = temp_body.replace("XXavg_grade2XX", avg_grade[i])
# Append body to array
email_bodies.append(temp_body)
# Compose email text for each student
......
......@@ -17,7 +17,7 @@ mv -vf $inputbackupname archives/
# Import output of M11 into input of M12
rsync -avh --delete ../M11_generate_graded/done/ $inputfolder/pdfs/
rsync -avh --delete ../M11_generate_graded/script_output/done/ $inputfolder/pdfs/
# Clear output folder
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment