Add exam scores user template with dynamic answer display and feedback
This commit is contained in:
+5
-1
@@ -146,6 +146,9 @@ import plotly.express as px
|
||||
from django.db.models import Prefetch
|
||||
|
||||
|
||||
from loguru import logger
|
||||
|
||||
|
||||
class RedirectMixin:
|
||||
def get_success_url(self) -> str:
|
||||
if "redirect" in self.request.GET:
|
||||
@@ -2329,6 +2332,7 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
if not exam.publish_results and not view_all_results:
|
||||
correct_answer = "*****"
|
||||
answer_score = 0
|
||||
logger.debug(f"{ans=} {answer_score=} {correct_answer=}")
|
||||
answers.append(ans)
|
||||
answers_marks.append(answer_score)
|
||||
|
||||
@@ -2345,7 +2349,7 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
case "physics":
|
||||
total_score = sum(sum(i) for i in answers_marks)
|
||||
case _:
|
||||
if "unmarked" in answers_marks:
|
||||
if "unmarked" in answers_marks or None in answers_marks:
|
||||
answered = [i for i in answers_marks if type(i) == int]
|
||||
total_score = sum(answered)
|
||||
unmarked_number = len(answers_marks) - len(answered)
|
||||
|
||||
Reference in New Issue
Block a user