This commit is contained in:
Ross
2022-04-02 23:14:44 +01:00
parent 7930443029
commit f3af33c92c
4 changed files with 94 additions and 39 deletions
@@ -0,0 +1,27 @@
{% extends 'atlas/base.html' %}
{% block content %}
{% include 'atlas:collection_headers.html' %}
<p>{{cid_user_count}} candidates.</p>
<ol>
{% for cid in cid_users %}
<li><a href="{% url 'generic:update_cid' cid.pk %}">{{cid.cid}}</a> [{{cid.passcode}}] {{cid.name}} /
Email: {{cid.email}}
{% if cid.supervisor_email %} / Supervisor email: {{cid.supervisor_email}}{% endif %} <br />
Internal candidate: {{cid.internal_candidate}}
{% if cid.login_email_sent %} / Login email sent{% endif %}
{% if cid.results_email_sent %} / Results email sent{% endif %}
</li>
{% endfor %}
</ol>
<a href="{% url 'generic:manage_cids' %}">Manage CIDs here</a>
{% endblock %}
+1 -19
View File
@@ -1,25 +1,7 @@
{% extends 'atlas/base.html' %}
{% block content %}
{% if request.user.is_authenticated %}
Collection: {{collection.name}}-> <a href="{% url 'atlas:collection_detail' pk=collection.pk %}">Overview</a> /
<a href="{% url 'atlas:collection_mark_cid' 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>
<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>
{% comment %} \ <a href="{% url 'atlas:collection_clone' collection.id %}" title="Clone the Collection">Clone</a> {% endcomment %}
{% if request.user.is_superuser %}
\ <a href="{% url 'admin:atlas_casecollection_change' collection.id %}" title="Edit the Collection using the admin interface">Admin Edit</a>
{% endif %}
</div>
{% endif %}
<h2>{{collection.name}}
{% include 'exam_notes.html' %}
{% include 'atlas:collection_headers.html' %}
<ul>
{% for case in collection.cases.all %}
<li><a href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}">Case {{forloop.counter}}</a>
@@ -0,0 +1,20 @@
{% if request.user.is_authenticated %}
Collection: {{collection.name}}-> <a href="{% url 'atlas:collection_detail' pk=collection.pk %}">Overview</a> /
<a href="{% url 'atlas:collection_mark_cid' 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>
<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>
{% comment %} \ <a href="{% url 'atlas:collection_clone' collection.id %}" title="Clone the Collection">Clone</a> {% endcomment %}
{% if request.user.is_superuser %}
\ <a href="{% url 'admin:atlas_casecollection_change' collection.id %}" title="Edit the Collection using the admin interface">Admin Edit</a>
{% endif %}
</div>
{% endif %}
<h2>{{collection.name}}</h2>
{% include 'exam_notes.html' %}
+46 -20
View File
@@ -308,11 +308,13 @@ class SeriesDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
template_name = "confirm_delete.html"
success_url = reverse_lazy("atlas:series_view")
class CaseCollectionDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
model = CaseCollection
template_name = "confirm_delete.html"
success_url = reverse_lazy("atlas:collection_view")
class ConditionDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
model = Condition
template_name = "confirm_delete.html"
@@ -1044,7 +1046,7 @@ def categories_list(request):
)
#def collection_view(request):
# def collection_view(request):
# collections = CaseCollection.objects.all()
#
# return render(
@@ -1062,40 +1064,52 @@ class CollectionView(LoginRequiredMixin, SingleTableMixin, FilterView):
def collection_detail(request, pk):
collection = get_object_or_404(CaseCollection, pk=pk)
return render(
request, "atlas/collection_detail.html", {"collection": collection}
)
return render(request, "atlas/collection_detail.html", {"collection": collection})
def collection_take(request, pk):
collection = get_object_or_404(CaseCollection, pk=pk)
return render(
request, "atlas/collection_take.html", {"collection": collection}
)
return render(request, "atlas/collection_take.html", {"collection": collection})
@user_is_collection_author_or_atlas_editor
def collection_mark_cid(request, pk):
collection = get_object_or_404(CaseCollection, pk=pk)
return render(
request, "atlas/collection_take.html", {"collection": collection}
)
return render(request, "atlas/collection_take.html", {"collection": collection})
@user_is_collection_author_or_atlas_editor
def collection_scores_cid(request, pk):
collection = get_object_or_404(CaseCollection, pk=pk)
return render(
request, "atlas/collection_take.html", {"collection": collection}
)
return render(request, "atlas/collection_take.html", {"collection": collection})
@user_is_collection_author_or_atlas_editor
def collection_candidates(request, pk):
collection = get_object_or_404(CaseCollection, pk=pk)
return render(
request, "atlas/collection_take.html", {"collection": collection}
)
if (
request.user in collection.author.all()
or request.user.groups.filter(name="cid_user_manager").exists()
):
cid_users = collection.valid_users.all()
cid_user_count = cid_users.count()
return render(
request,
"atlas/collection_candidates.html",
{
"collection": collection,
"cid_users": cid_users,
"cid_user_count": cid_user_count,
},
)
raise PermissionDenied
def collection_take_overview(request, pk, cid, passcode):
collection = get_object_or_404(CaseCollection, pk=pk)
@@ -1141,12 +1155,14 @@ def collection_take_overview(request, pk, cid, passcode):
},
)
def collection_case_view_take(request, pk, case_number, cid, passcode):
return collection_case_view(request, pk, case_number, True, cid, passcode)
def collection_case_view(request, pk, case_number, take=False, cid=None, passcode=None):
collection = get_object_or_404(CaseCollection, pk=pk)
form = None
if collection.collection_type != collection.COLLECTION_TYPE_CHOICES.REVIEW:
@@ -1183,14 +1199,24 @@ def collection_case_view(request, pk, case_number, take=False, cid=None, passcod
kwargs = {"pk": pk, "cid": cid, "passcode": passcode}
if "next" in request.POST:
return redirect("atlas:collection_case_view_take", case_number=case_number + 1, **kwargs)
return redirect(
"atlas:collection_case_view_take",
case_number=case_number + 1,
**kwargs
)
elif "previous" in request.POST:
return redirect("atlas:collection_case_view_take", case_number=case_number - 1, **kwargs)
return redirect(
"atlas:collection_case_view_take",
case_number=case_number - 1,
**kwargs
)
elif "finish" in request.POST:
return redirect("atlas:collection_take_overview", **kwargs)
elif "goto" in request.POST:
return redirect(
"atlas:collection_case_view_take", case_number=int(request.POST.get("goto")), **kwargs
"atlas:collection_case_view_take",
case_number=int(request.POST.get("goto")),
**kwargs
)
else:
form = CidReportAnswerForm(instance=answer)