diff --git a/anatomy/views.py b/anatomy/views.py index dcedda9f..dc0d9b90 100644 --- a/anatomy/views.py +++ b/anatomy/views.py @@ -590,20 +590,15 @@ def exam_scores_cid(request, pk): user_answers[cid].append("") continue - ans = s[0].answer - if q.answers.filter(answer__iexact=ans, status=Answer.MarkOptions.CORRECT).first() is not None: - a = 2 - elif q.answers.filter(answer__iexact=ans, status=Answer.MarkOptions.HALF_MARK).first() is not None: - a = 1 - else: - a = 0 - user_answers[cid].append(ans) - user_answers_marks[cid].append(a) - user_answers_and_marks[cid].append((ans, a)) + ans = user_answer.answer + answer_score = user_answer.get_answer_score() + user_answers[u].append(ans) + user_answers_marks[u].append(answer_score) + user_answers_and_marks[u].append((ans, answer_score)) user_scores = {} for user in user_answers_marks: - user_scores[user] = sum(user_answers_marks[user]) + user_scores[user] = sum([i for i in user_answers_marks[user] if i != "unmarked"]) user_scores_list = list(user_scores.values())