start adding self review to collections

This commit is contained in:
Ross
2023-07-10 09:06:46 +01:00
parent c799f106d7
commit 9a5088c03a
7 changed files with 79 additions and 11 deletions
+9 -5
View File
@@ -1255,7 +1255,7 @@ def collection_take_overview(
):
collection = get_object_or_404(CaseCollection, pk=pk)
if not collection.active:
if not collection.active and not collection.self_review:
raise Http404("Exam not found")
if not collection.check_cid_user(cid, passcode, request):
@@ -1268,7 +1268,9 @@ def collection_take_overview(
if cid is not None:
answers = CidReportAnswer.objects.filter(cid=cid, question__in=case_details)
else:
answers = UserReportAnswer.objects.filter(user=request.user, question__in=case_details)
answers = UserReportAnswer.objects.filter(
user=request.user, question__in=case_details
)
answer_question_map = {}
for ans in answers:
@@ -1283,7 +1285,9 @@ def collection_take_overview(
else:
question_answer_tuples.append((q, None))
cid_user_exam = collection.get_or_create_cid_user_exam(cid=cid, user_user=request.user)
cid_user_exam = collection.get_or_create_cid_user_exam(
cid=cid, user_user=request.user
)
return render(
request,
@@ -1317,7 +1321,7 @@ def collection_case_view_take(
answer: CidReportAnswer | UserReportAnswer
if collection.collection_type != collection.COLLECTION_TYPE_CHOICES.REVIEW:
if not collection.active:
if not collection.active and not collection.self_review:
raise Http404("Exam not found")
if cid is not None and not collection.check_cid_user(cid, passcode, request):
@@ -1439,7 +1443,7 @@ def collection_case_view(request, pk, case_number):
answer = None
if collection.collection_type != collection.COLLECTION_TYPE_CHOICES.REVIEW:
if not collection.active:
if not collection.active and not collection.self_review:
raise Http404("Exam not found")
cases = collection.cases.all().order_by("casedetail__sort_order").prefetch_related()