This commit is contained in:
Ross
2021-03-12 08:55:48 +00:00
parent ccd72e987d
commit bf29e0d394
+5 -5
View File
@@ -993,16 +993,16 @@ def question_json(request, pk):
#if not exam.active: #if not exam.active:
# raise Http404("No available exam") # raise Http404("No available exam")
question_json_cache = cache.get("{}_question_json_{}".format("longs", pk)) path= "{0}longs/questions/{1}.json".format(settings.MEDIA_ROOT, question_id)
url= "{0}{1}/exam/{2}.json".format(settings.MEDIA_URL, self.app_name, pk)
if os.path.isfile(path) and not exam.recreate_json:
if question_json_cache is not None and not question.recreate_json: if question_json_cache is not None and not question.recreate_json:
#question_json_cache["cached"] = True return redirect(url)
return redirect(question_json_cache)
question_json = question.get_json(pk) question_json = question.get_json(pk)
cache.set("{}_question_json_{}".format("longs", pk), question_json, 3600)
question.recreate_json = False question.recreate_json = False
question.save() question.save()