Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit bad701d

Browse files
committed
Fix: Add missing users to the grades table.
1 parent 809dca6 commit bad701d

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

modules/questions_report.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,12 +571,27 @@ def query_assignment(
571571
),
572572
):
573573

574+
# If a student answers no questions, then is autograded, then is removed from the course, the headings query doesn't contain this student. Add them in.
575+
username = row.question_grades.sid
576+
if username not in grades:
577+
au_row = (
578+
db(db.auth_user.username == username)
579+
.select(
580+
db.auth_user.first_name, db.auth_user.last_name, db.auth_user.email
581+
)
582+
.first()
583+
)
584+
grades[username] = dict()
585+
grades[username][None] = _UserInfo._make(
586+
[au_row.first_name, au_row.last_name, au_row.email]
587+
)
588+
574589
# Get the answer and correct info based on the type of question.
575590
question_type = grades[None][row.question_grades.div_id].type_
576591
answer, correct, timestamp = _row_decode(row, question_type)
577592

578593
# Place the query into its appropriate matrix location.
579-
grades[row.question_grades.sid][row.question_grades.div_id] = [
594+
grades[username][row.question_grades.div_id] = [
580595
timestamp,
581596
row.question_grades.score,
582597
answer,

0 commit comments

Comments
 (0)