This commit is contained in:
Ross
2024-01-08 13:52:27 +00:00
parent 21be2d8408
commit f839ca4ed5
+5 -2
View File
@@ -2131,8 +2131,11 @@ class ExamViews(View, LoginRequiredMixin):
else: else:
#Exclude very low scores from statistics #Exclude very low scores from statistics
lower_score_bound = max_score / 5 lower_score_bound = max_score / 5
bounded_scores = [i for i in user_scores_list if i > lower_score_bound]
mean = statistics.mean([i for i in user_scores_list if i > lower_score_bound]) if bounded_scores:
mean = statistics.mean(bounded_scores)
else:
mean = statistics.mean(user_scores_list)
median = statistics.median(user_scores_list) median = statistics.median(user_scores_list)
try: try:
mode = statistics.mode(user_scores_list) mode = statistics.mode(user_scores_list)