This commit is contained in:
Ross
2021-02-01 12:51:39 +00:00
parent 61c5ee7019
commit 61ac45d507
2 changed files with 7 additions and 2 deletions
+2
View File
@@ -222,6 +222,8 @@ class Rapid(models.Model):
def GetPrimaryAnswer(self):
if len(self.answers.all()) > 0:
return self.answers.all().first().answer
elif self.normal:
return "Normal"
else:
return "None yet..."
+4 -1
View File
@@ -1017,15 +1017,18 @@ def exam_scores_cid_user(request, pk, sk):
for q in questions:
# Get user answer
user_answer = q.cid_user_answers.filter(cid=cid).first()
if not user_answer:
# skip if no answer
answers_marks.append(0)
answers.append("")
answer_score = 0
ans = "Not answered"
elif user_answer.normal:
ans = "Normal"
else:
ans = user_answer.answer
answer_score = user_answer.get_answer_score()
correct_answer = q.GetPrimaryAnswer()