This commit is contained in:
Ross
2021-02-28 16:28:15 +00:00
parent fd629489de
commit 549abd5305
3 changed files with 29 additions and 7 deletions
+7 -7
View File
@@ -374,14 +374,14 @@ class ExamViews(View, LoginRequiredMixin):
if not exam.active:
raise Http404("No available exam")
exam_json_cache = cache.get("{}_exam_json_{}_{}".format(self.app_name, pk, sk))
question_json_cache = cache.get("{}_question_json_{}".format(self.app_name, sk))
if exam_json_cache is not None and not exam.recreate_json:
exam_json_cache["cached"] = True
return JsonResponse(exam_json_cache)
if question_json_cache is not None and not exam.recreate_json:
question_json_cache["cached"] = True
return JsonResponse(question_json_cache)
exam_json = exam.get_exam_question_json(sk)
question_json = exam.get_exam_question_json(sk)
cache.set("{}_exam_json_{}_{}".format(self.app_name, pk, sk), exam_json, 3600)
cache.set("{}_question_json_{}".format(self.app_name, sk), question_json, 3600)
return JsonResponse(exam_json)
return JsonResponse(question_json)