improve stats handling

This commit is contained in:
Ross
2024-01-08 22:46:46 +00:00
parent 9d05e5d34e
commit d6f1de2036
10 changed files with 166 additions and 11 deletions
+17 -1
View File
@@ -2162,7 +2162,7 @@ class ExamViews(View, LoginRequiredMixin):
exam.stats_min = min(user_scores_list)
exam.stats_max = max(user_scores_list)
# exam.stats_graph = fig_html
exam.stats_graph = fig_html
user_data = {}
for u in cids:
@@ -2225,6 +2225,22 @@ class ExamViews(View, LoginRequiredMixin):
template_variables,
)
def exam_stats(self, request, exam_id):
exam = get_object_or_404(self.Exam, pk=exam_id)
if not exam.exam_mode:
raise Http404("Packet not in exam mode")
template_variables = {
"exam": exam
}
return render(
request,
"exam_stats.html",
template_variables,
)
class GenericViewBase:
def __init__(self, app_name, QuestionObject, UserAnswerObject, ExamObject):