.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Collection: {{collection.name}}-> <a href="{% url 'atlas:collection_detail' pk=collection.pk %}">Overview</a> /
|
||||
<a href="{% url 'atlas:collection_mark_overview' collection.pk %}">Mark</a> /
|
||||
<a href="{% url 'atlas:collection_scores_cid' collection.pk %}">Scores</a> /
|
||||
<a href="{% url 'atlas:collection_candidates' collection.pk %}">Candidates</a>
|
||||
<a href="{% url 'atlas:exam_cids' collection.pk %}">Candidates</a>
|
||||
<div class="floating-header">
|
||||
<a href="{% url 'atlas:collection_update' collection.id %}" title="Edit the Collection">Edit</a>
|
||||
\ <a href="{% url 'atlas:collection_delete' collection.id %}" title="Delete the Collection">Delete</a>
|
||||
|
||||
+2
-1
@@ -19,7 +19,8 @@ urlpatterns = [
|
||||
path("collection/<int:pk>/update", views.CaseCollectionUpdate.as_view(), name="collection_update"),
|
||||
path("collection/<int:pk>", views.collection_detail, name="collection_detail"),
|
||||
path("collection/<int:pk>/take", views.collection_take, name="collection_take"),
|
||||
path("collection/<int:pk>/candidates", views.collection_candidates, name="collection_candidates"),
|
||||
path("collection/<int:exam_id>/cids", views.GenericExamViews.exam_cids, name="exam_cids"),
|
||||
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"),
|
||||
path("collection/<int:pk>/scores", views.collection_scores_cid, name="collection_scores_cid"),
|
||||
|
||||
+6
-2
@@ -1165,7 +1165,7 @@ def collection_mark_question(request, pk, case_number):
|
||||
|
||||
|
||||
@user_is_collection_author_or_atlas_editor
|
||||
def collection_candidates(request, pk):
|
||||
def exam_cids(request, pk):
|
||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||
|
||||
if (
|
||||
@@ -1177,7 +1177,7 @@ def collection_candidates(request, pk):
|
||||
cid_user_count = cid_users.count()
|
||||
return render(
|
||||
request,
|
||||
"atlas/collection_candidates.html",
|
||||
"atlas/exam_cids.html",
|
||||
{
|
||||
"collection": collection,
|
||||
"cid_users": cid_users,
|
||||
@@ -1510,3 +1510,7 @@ def collection_scores_cid(request, pk):
|
||||
"plot": fig_html,
|
||||
},
|
||||
)
|
||||
|
||||
GenericExamViews = ExamViews(
|
||||
CaseCollection, Case, None, CidReportAnswer, "casecollection", "case", None
|
||||
)
|
||||
@@ -24,10 +24,7 @@
|
||||
<script>
|
||||
$(document).ready(() => {
|
||||
$(".toggle-btn").click((el) => {
|
||||
console.log(el);
|
||||
console.log(el.target.dataset.pk);
|
||||
parent = $(el.target).parent()
|
||||
console.log(!parent.hasClass("current"));
|
||||
$.ajax({
|
||||
url: "{% url exam.app_name|add:':exam_json_edit' exam.pk %}",
|
||||
data: {
|
||||
|
||||
+13
-5
@@ -328,6 +328,11 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
and not user.groups.filter(name="sba_checker").exists()
|
||||
):
|
||||
return False
|
||||
if (
|
||||
self.app_name == "casecollection"
|
||||
and not user.groups.filter(name="casecollection_checker").exists()
|
||||
):
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_user_edit_access(self, user, exam_id=None):
|
||||
@@ -370,6 +375,11 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
and not user.groups.filter(name="sba_checker").exists()
|
||||
):
|
||||
return False
|
||||
if (
|
||||
self.app_name == "casecollection"
|
||||
and not user.groups.filter(name="casecollection_checker").exists()
|
||||
):
|
||||
return False
|
||||
return True
|
||||
|
||||
@method_decorator(login_required)
|
||||
@@ -593,8 +603,8 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
def exam_cids(self, request, exam_id):
|
||||
exam = get_object_or_404(self.Exam, pk=exam_id)
|
||||
|
||||
if not request.user.groups.filter(name="cid_user_manager").exists():
|
||||
raise PermissionDenied
|
||||
#if not request.user.groups.filter(name="cid_user_manager").exists():
|
||||
# raise PermissionDenied
|
||||
|
||||
if request.user not in exam.author.all():
|
||||
if not self.check_user_access(request.user, exam_id):
|
||||
@@ -678,13 +688,11 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
|
||||
add = request.POST.get("add") == "true"
|
||||
|
||||
print(user_id)
|
||||
print(request.POST)
|
||||
|
||||
cid_user = CidUser.objects.get(pk=user_id)
|
||||
|
||||
app_exam_map = {}
|
||||
app_exam_map["rapids"] = cid_user.rapid_exams
|
||||
app_exam_map["casecollection"] = cid_user.casecollection_exams
|
||||
|
||||
if add:
|
||||
app_exam_map[self.app_name].add(pk)
|
||||
|
||||
Reference in New Issue
Block a user