This commit is contained in:
Ross
2021-12-18 17:45:48 +00:00
parent 8b8ab773ea
commit 2a3b8b06df
2 changed files with 18 additions and 10 deletions
+6
View File
@@ -468,6 +468,12 @@ class CidUserAnswer(models.Model):
# s = s.translate(str.maketrans('', '', string.punctuation)) # s = s.translate(str.maketrans('', '', string.punctuation))
# return s # return s
def get_blank_answer(self):
return 0
def get_blank_answer_string(self):
return ""
def get_answer_score(self, cached=True): def get_answer_score(self, cached=True):
if cached and self.score: if cached and self.score:
if self.score == Answer.MarkOptions.CORRECT: if self.score == Answer.MarkOptions.CORRECT:
+12 -10
View File
@@ -896,6 +896,8 @@ class ExamViews(View, LoginRequiredMixin):
user_scores_list = list(user_scores.values()) user_scores_list = list(user_scores.values())
max_score = len(questions) * 2
if len(user_scores_list) < 1: if len(user_scores_list) < 1:
mean = 0 mean = 0
median = 0 median = 0
@@ -920,20 +922,20 @@ class ExamViews(View, LoginRequiredMixin):
) )
fig_html = fig.to_html() fig_html = fig.to_html()
max_score = len(questions) * 2 exam.stats_mean = mean
exam.stats_median = median
exam.stats_mode = mode
exam.stats_mean = mean exam.stats_candidates = len(user_scores_list)
exam.stats_median = median exam.stats_max_possible = max_score
exam.stats_mode = mode
exam.stats_candidates = len(user_scores_list) exam.stats_min = min(user_scores_list)
exam.stats_max_possible = max_score exam.stats_max = max(user_scores_list)
exam.stats_graph = fig_html
exam.save()
exam.stats_min = min(user_scores_list)
exam.stats_max = max(user_scores_list)
exam.stats_graph = fig_html
exam.save()
return render( return render(
request, request,