start adding self review to collections
This commit is contained in:
+9
-5
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user