This commit is contained in:
Ross
2022-04-25 22:44:32 +01:00
parent 253a125101
commit fce0f97ebd
2 changed files with 14 additions and 0 deletions
+1
View File
@@ -20,6 +20,7 @@ urlpatterns = [
path("collection/<int:pk>", views.collection_detail, name="collection_detail"),
path("collection/<int:pk>/take", views.collection_take, name="collection_take"),
path("collection/<int:exam_id>/cids", views.GenericExamViews.exam_cids, name="exam_cids"),
path("collection/<int:exam_id>/cids/<int:cid>/delete_answers", views.delete_cid_answers, name="delete_cid_answers"),
path("collection/<int:exam_id>/cids/edit", views.GenericExamViews.exam_cids_edit, name="exam_cids_edit"),
path("collection/<int:pk>/mark", views.collection_mark_overview, name="collection_mark_overview"),
path("collection/<int:pk>/mark/<int:case_number>", views.collection_mark_question, name="collection_mark_question"),
+13
View File
@@ -1367,6 +1367,19 @@ def collection_case_view(request, pk, case_number):
},
)
@user_is_collection_author_or_atlas_editor
def delete_cid_answers(request, exam_id, cid):
collection = get_object_or_404(CaseCollection, pk=pk)
cases = collection.cases.all().order_by("casedetail__sort_order").prefetch_related()
case_details = CaseDetail.objects.filter(
case__in=cases, collection=collection
).prefetch_related("case")
cid_user_answers = CidReportAnswer.objects.filter(question__in=case_details, cid=cid)
return JsonResponse(cid_user_answers)
# TODO: this needs a major cleanup
@user_is_collection_author_or_atlas_editor