From 76b4746b139d140d19b991c5597a7644d049e630 Mon Sep 17 00:00:00 2001 From: Ross Date: Tue, 9 Jan 2024 23:41:48 +0000 Subject: [PATCH] add option to view cid candidate name in scores page --- generic/templates/generic/exam_cids.html | 90 ++++++++++++++----- .../templates/generic/exam_scores_base.html | 24 ++++- generic/urls.py | 1 + generic/views.py | 12 +++ templates/exam_user_status.html | 8 +- 5 files changed, 104 insertions(+), 31 deletions(-) diff --git a/generic/templates/generic/exam_cids.html b/generic/templates/generic/exam_cids.html index e17eedb9..d10d84c1 100644 --- a/generic/templates/generic/exam_cids.html +++ b/generic/templates/generic/exam_cids.html @@ -1,13 +1,36 @@ +

CID candidates

{% if cid_users %}

{{cid_user_count}} CID candidates.

+
+
    {% for cid in cid_users %} -
  1. {{cid.cid}} [{{cid.passcode}}]
    {{cid.name}}
    Email: {{cid.email}}
    +
  2. + + {{cid.cid}} [{{cid.passcode}}]
    {{cid.name}}
    Email: {{cid.email}}
  3. {% endfor %} @@ -29,7 +52,18 @@
      {% for user in user_users %} -
    1. {{user.username}}
      +
    2. + +
      + + {{user.username}}
      Email: {{user.email}}
    3. @@ -64,37 +98,47 @@
- +
{% endif %} + + Exam history + {% block js %} - + }) + {% endblock js %} {% block css %} - + {% endblock css %} - - + + diff --git a/generic/templates/generic/exam_scores_base.html b/generic/templates/generic/exam_scores_base.html index d4fae0fe..753c003f 100644 --- a/generic/templates/generic/exam_scores_base.html +++ b/generic/templates/generic/exam_scores_base.html @@ -51,8 +51,8 @@
- - + + {% if exam.app_name == "longs" or exam.app_name == "rapids" %} {% endif %} @@ -60,9 +60,16 @@ {% for cid in cids %} {% if cid|slice:":1" == "u" %} - + {% else %} - + {% endif %} @@ -172,6 +179,15 @@ content: "*"; color: red; } + + .search-cid { + display: none; + } + + .cid:hover .search-cid { + display: inline-block; + color: darkblue; + } {% endblock %} \ No newline at end of file diff --git a/generic/urls.py b/generic/urls.py index 24136abd..427990be 100755 --- a/generic/urls.py +++ b/generic/urls.py @@ -123,6 +123,7 @@ urlpatterns = [ name="user_group_create", ), path("cids/create", views.manage_cid_users, name="manage_cid_users"), + path("cids//details", views.cid_details, name="cid_details"), path("cids/create/email", views.create_cid_email, name="create_cid_email"), path("supervisor", views.SupervisorList.as_view(), name="supervisor"), path( diff --git a/generic/views.py b/generic/views.py index c81fa746..0373338f 100644 --- a/generic/views.py +++ b/generic/views.py @@ -2047,6 +2047,7 @@ class ExamViews(View, LoginRequiredMixin): user_ids = set() cids_user_id_map = {} + cids_name_map = {} # Loop through all candidates 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): 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 def manage_cid_users(request): diff --git a/templates/exam_user_status.html b/templates/exam_user_status.html index 4b3d396c..7073ab5a 100644 --- a/templates/exam_user_status.html +++ b/templates/exam_user_status.html @@ -1,5 +1,4 @@ {% if statuses %} - +{% else %} + Nil recorded. {% endif %}
Candidate IDScoreCandidate IDScoreNormalised Score
{{cids_user_id_map|get_item:cid}}{{cids_user_id_map|get_item:cid}}{{cid}}{{cid}} + + + + {{user_scores|get_item:cid}}