High candidates that have submitted results
This commit is contained in:
@@ -7,12 +7,8 @@
|
||||
<ol>
|
||||
{% for cid in cid_users %}
|
||||
|
||||
<li><a href="{% url 'generic:update_cid' cid.pk %}">{{cid.cid}}</a> [{{cid.passcode}}] {{cid.name}} /
|
||||
<li class="cid-user" data-cid={{cid.cid}}><a href="{% url 'generic:update_cid' cid.pk %}">{{cid.cid}}</a> [{{cid.passcode}}] {{cid.name}} /
|
||||
Email: {{cid.email}}
|
||||
{% if cid.supervisor %} / 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 %}
|
||||
@@ -34,7 +30,7 @@
|
||||
<ol>
|
||||
{% for user in user_users %}
|
||||
|
||||
<li>{{user.username}}
|
||||
<li class="user-user" data-user="{{user.username}}">{{user.username}}
|
||||
Email: {{user.email}}
|
||||
</li>
|
||||
|
||||
@@ -51,21 +47,54 @@
|
||||
|
||||
{% if user_exam_data %}
|
||||
<div class="card text-white bg-dark">
|
||||
<h3>Submitted candidates</h3>
|
||||
<ul>
|
||||
{% for user_data in user_exam_data %}
|
||||
<li>
|
||||
CID: {{user_data.cid_user}} /
|
||||
User: {{user_data.user_user}} /
|
||||
Start time: {{user_data.start_time}} /
|
||||
End time: {{user_data.end_time}} /
|
||||
<details>
|
||||
<summary>
|
||||
<h3>Submitted candidates</h3>
|
||||
</summary>
|
||||
<ul id="submitted-candidates">
|
||||
{% for user_data in user_exam_data %}
|
||||
<li data-cid="{{user_data.cid_user}}" data-user="{{user_data.user_user}}">
|
||||
CID: {{user_data.cid_user}} /
|
||||
User: {{user_data.user_user}} /
|
||||
Start time: {{user_data.start_time}} /
|
||||
End time: {{user_data.end_time}} /
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
{% block js %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Highlight users that have submitted answers
|
||||
$("#submitted-candidates li").each(function(n, el) {
|
||||
console.log(el);
|
||||
if (el.dataset.cid != "None") {
|
||||
$(`.cid-user[data-cid=${el.dataset.cid}]`).addClass("submitted")
|
||||
}
|
||||
if (el.dataset.user != "None") {
|
||||
$(`.user-user[data-user=${el.dataset.user}]`).addClass("submitted")
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
{% endblock js %}
|
||||
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
.submitted {
|
||||
color: green;
|
||||
}
|
||||
</style>
|
||||
{% endblock css %}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -266,5 +266,15 @@ def generic_exam_urls(generic_exam_view: GenericExamViews):
|
||||
generic_exam_view.exam_user_status,
|
||||
name="exam_user_status",
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/user_status/<int:cid>/cid",
|
||||
generic_exam_view.exam_user_status_cid,
|
||||
name="exam_user_status_cid",
|
||||
),
|
||||
path(
|
||||
"exam/<int:pk>/user_status/<int:user_id>/user",
|
||||
generic_exam_view.exam_user_status_user,
|
||||
name="exam_user_status_user",
|
||||
),
|
||||
]
|
||||
return urlpatterns
|
||||
|
||||
+14
-2
@@ -999,14 +999,26 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
|
||||
return notes
|
||||
|
||||
def exam_user_status(self, request, pk):
|
||||
def exam_user_status_cid(self, request, pk, cid):
|
||||
return self.exam_user_status(request, pk, cid=cid)
|
||||
|
||||
def exam_user_status_user(self, request, pk, user_id):
|
||||
return self.exam_user_status(request, pk, user_id=user_id)
|
||||
|
||||
def exam_user_status(self, request, pk, cid=None, user_id=None):
|
||||
# TODO: add filtering by user / cid
|
||||
exam = get_object_or_404(self.Exam, pk=pk)
|
||||
|
||||
# Restrict just to exam authors
|
||||
if request.user not in exam.author.all():
|
||||
raise PermissionDenied
|
||||
|
||||
statuses = exam.exam_user_status.all()
|
||||
if cid is not None:
|
||||
statuses = exam.exam_user_status.filter(cid_user__cid=cid)
|
||||
elif user_id is not None:
|
||||
statuses = exam.exam_user_status.filter(user_user__id=user_id)
|
||||
else:
|
||||
statuses = exam.exam_user_status.all()
|
||||
|
||||
return render(request, "exam_user_status.html", {"exam": exam, "statuses": statuses})
|
||||
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import secrets
|
||||
from django.conf import settings
|
||||
|
||||
from django_tables2 import SingleTableMixin
|
||||
from atlas.models import CaseCollection, CidReportAnswer
|
||||
@@ -743,4 +744,4 @@ def request_cid_details(request):
|
||||
cid_user.email_details()
|
||||
|
||||
|
||||
return HttpResponse("Candidate details will be sent to the requested email (if it is found in the system).")
|
||||
return HttpResponse(f"Candidate details will be sent to the requested email (if it is found in the system). If you have not received an email after a few minutes you may need to contact <a href='mailto:{settings.CONTACT_EMAIL}'>{settings.CONTACT_EMAIL}</a>")
|
||||
|
||||
Reference in New Issue
Block a user