add option to view cid candidate name in scores page
This commit is contained in:
@@ -1,13 +1,36 @@
|
|||||||
|
<div id="history-modal"
|
||||||
|
class="modal modal-blur fade"
|
||||||
|
style="display: none"
|
||||||
|
aria-hidden="false"
|
||||||
|
tabindex="-1">
|
||||||
|
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
|
||||||
|
<h2>Exam user history:
|
||||||
|
<span id="history-user"></span>
|
||||||
|
</h2>
|
||||||
|
<div class="modal-content"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card text-white bg-dark">
|
<div class="card text-white bg-dark">
|
||||||
<h3>CID candidates</h3>
|
<h3>CID candidates</h3>
|
||||||
{% if cid_users %}
|
{% if cid_users %}
|
||||||
<p>{{cid_user_count}} CID candidates.</p>
|
<p>{{cid_user_count}} CID candidates.</p>
|
||||||
|
|
||||||
|
<div id="htmx-info"></div>
|
||||||
|
|
||||||
<ol class="cid-candidate-list">
|
<ol class="cid-candidate-list">
|
||||||
{% for cid in cid_users %}
|
{% for cid in cid_users %}
|
||||||
|
|
||||||
<li class="cid-user" data-cid={{cid.cid}}><div class="cid-data"><a href="{% url 'generic:update_cid' cid.pk %}">{{cid.cid}}</a> [{{cid.passcode}}]</div><div class="cid-name">{{cid.name}}</div> <div class="cid-email">Email: {{cid.email}}</div>
|
<li class="cid-user" data-cid={{cid.cid}}><div class="cid-data">
|
||||||
|
<i class="bi bi-clock-history"
|
||||||
|
title="View user exam history"
|
||||||
|
hx-get="{% url exam.app_name|add:':exam_user_status_cid' exam.id cid.cid %}"
|
||||||
|
hx-target=".modal-content"
|
||||||
|
data-bs-toggle="modal"
|
||||||
|
data-bs-target="#history-modal"
|
||||||
|
_="on htmx:afterOnLoad put {{cid.cid}} into #history-user.innerHTML "
|
||||||
|
></i>
|
||||||
|
<a href="{% url 'generic:update_cid' cid.pk %}">{{cid.cid}}</a> [{{cid.passcode}}]</div><div class="cid-name">{{cid.name}}</div> <div class="cid-email">Email: {{cid.email}}</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -29,7 +52,18 @@
|
|||||||
<ol class="user-candidate-list">
|
<ol class="user-candidate-list">
|
||||||
{% for user in user_users %}
|
{% for user in user_users %}
|
||||||
|
|
||||||
<li class="user-user" data-user="{{user.username}}"><div>{{user.username}}</div>
|
<li class="user-user" data-user="{{user.username}}">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<i class="bi bi-clock-history"
|
||||||
|
title="View user exam history"
|
||||||
|
hx-get="{% url exam.app_name|add:':exam_user_status_user' exam.id user.id %}"
|
||||||
|
hx-target=".modal-content"
|
||||||
|
data-bs-toggle="modal"
|
||||||
|
data-bs-target="#history-modal"
|
||||||
|
_="on htmx:afterOnLoad put {{cid.cid}} into #history-user.innerHTML "
|
||||||
|
></i>
|
||||||
|
{{user.username}}</div>
|
||||||
<div>Email: {{user.email}}</div>
|
<div>Email: {{user.email}}</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -64,36 +98,46 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
<br/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<span
|
||||||
|
title="View all user exam history"
|
||||||
|
hx-get="{% url exam.app_name|add:':exam_user_status' exam.id %}"
|
||||||
|
hx-target=".modal-content"
|
||||||
|
data-bs-toggle="modal"
|
||||||
|
data-bs-target="#history-modal"
|
||||||
|
_="on htmx:afterOnLoad put {{cid.cid}} into #history-user.innerHTML "
|
||||||
|
>
|
||||||
|
Exam history <i class="bi bi-clock-history"></i>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% block js %}
|
{% block js %}
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Highlight users that have submitted answers
|
// Highlight users that have submitted answers
|
||||||
$("#submitted-candidates li").each(function(n, el) {
|
$("#submitted-candidates li").each(function(n, el) {
|
||||||
console.log(el);
|
console.log(el);
|
||||||
if (el.dataset.cid != "None") {
|
if (el.dataset.cid != "None") {
|
||||||
$(`.cid-user[data-cid=${el.dataset.cid}]`).addClass("submitted")
|
$(`.cid-user[data-cid=${el.dataset.cid}]`).addClass("submitted")
|
||||||
}
|
}
|
||||||
if (el.dataset.user != "None") {
|
if (el.dataset.user != "None") {
|
||||||
$(`.user-user[data-user="${el.dataset.user}"]`).addClass("submitted")
|
$(`.user-user[data-user="${el.dataset.user}"]`).addClass("submitted")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endblock js %}
|
{% endblock js %}
|
||||||
|
|
||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
<style>
|
<style>
|
||||||
.submitted {
|
.submitted {
|
||||||
color: green;
|
color: green;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock css %}
|
{% endblock css %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<table class="table table-dark table-striped table-hover table-sm cid-score-table sortable">
|
<table class="table table-dark table-striped table-hover table-sm cid-score-table sortable">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Candidate ID</th>
|
<th title="click to sort by candidate / user id">Candidate ID</th>
|
||||||
<th>Score</th>
|
<th title="click to sort by score">Score</th>
|
||||||
{% if exam.app_name == "longs" or exam.app_name == "rapids" %}
|
{% if exam.app_name == "longs" or exam.app_name == "rapids" %}
|
||||||
<th>Normalised Score</th>
|
<th>Normalised Score</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -60,9 +60,16 @@
|
|||||||
{% for cid in cids %}
|
{% for cid in cids %}
|
||||||
<tr class="candidate-row" data-answer-count={{user_answer_count|get_item:cid}}>
|
<tr class="candidate-row" data-answer-count={{user_answer_count|get_item:cid}}>
|
||||||
{% if cid|slice:":1" == "u" %}
|
{% if cid|slice:":1" == "u" %}
|
||||||
<td>{{cids_user_id_map|get_item:cid}}</td>
|
<td class="cid" >{{cids_user_id_map|get_item:cid}}</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td><a href="{% url 'cid_scores_admin' cid|slice:'2:' %}">{{cid}}</a></td>
|
<td class="cid" data-cid="{{cid|slice:'2:'}}"><a href="{% url 'cid_scores_admin' cid|slice:'2:' %}">{{cid}}</a>
|
||||||
|
<span title="Click to show candidate details"
|
||||||
|
hx-get="{% url 'generic:cid_details' cid|slice:'2:' %}"
|
||||||
|
hx-target="this"
|
||||||
|
>
|
||||||
|
<i class="bi bi-binoculars search-cid" ></i>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>{{user_scores|get_item:cid}}</td>
|
<td>{{user_scores|get_item:cid}}</td>
|
||||||
|
|
||||||
@@ -172,6 +179,15 @@
|
|||||||
content: "*";
|
content: "*";
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-cid {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cid:hover .search-cid {
|
||||||
|
display: inline-block;
|
||||||
|
color: darkblue;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -123,6 +123,7 @@ urlpatterns = [
|
|||||||
name="user_group_create",
|
name="user_group_create",
|
||||||
),
|
),
|
||||||
path("cids/create", views.manage_cid_users, name="manage_cid_users"),
|
path("cids/create", views.manage_cid_users, name="manage_cid_users"),
|
||||||
|
path("cids/<int:cid>/details", views.cid_details, name="cid_details"),
|
||||||
path("cids/create/email", views.create_cid_email, name="create_cid_email"),
|
path("cids/create/email", views.create_cid_email, name="create_cid_email"),
|
||||||
path("supervisor", views.SupervisorList.as_view(), name="supervisor"),
|
path("supervisor", views.SupervisorList.as_view(), name="supervisor"),
|
||||||
path(
|
path(
|
||||||
|
|||||||
@@ -2047,6 +2047,7 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
user_ids = set()
|
user_ids = set()
|
||||||
|
|
||||||
cids_user_id_map = {}
|
cids_user_id_map = {}
|
||||||
|
cids_name_map = {}
|
||||||
|
|
||||||
# Loop through all candidates
|
# Loop through all candidates
|
||||||
for cid_user_answer in cid_user_answers:
|
for cid_user_answer in cid_user_answers:
|
||||||
@@ -2791,6 +2792,17 @@ def candidate_email_results_resend(request, cid, resend=True):
|
|||||||
def create_cid_email(request):
|
def create_cid_email(request):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@user_is_cid_user_manager
|
||||||
|
def cid_details(request, cid: int):
|
||||||
|
print(cid)
|
||||||
|
if request.htmx:
|
||||||
|
cid_user = get_object_or_404(CidUser, cid=cid)
|
||||||
|
|
||||||
|
print(cid_user.name)
|
||||||
|
|
||||||
|
return HttpResponse(f"{cid_user.name} ({cid_user.email})")
|
||||||
|
|
||||||
|
raise PermissionDenied() # or Http404
|
||||||
|
|
||||||
@user_is_cid_user_manager
|
@user_is_cid_user_manager
|
||||||
def manage_cid_users(request):
|
def manage_cid_users(request):
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{% if statuses %}
|
{% if statuses %}
|
||||||
<div class="alert alert-warning" role="alert">
|
|
||||||
<ul>
|
<ul>
|
||||||
{% for status in statuses %}
|
{% for status in statuses %}
|
||||||
<li>
|
<li>
|
||||||
@@ -14,10 +13,11 @@
|
|||||||
{{status.status}}
|
{{status.status}}
|
||||||
{{status.extra}} {% endcomment %}
|
{{status.extra}} {% endcomment %}
|
||||||
|
|
||||||
{{status}}
|
{{status}}
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
{% else %}
|
||||||
|
Nil recorded.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user