From a8f710f4aa895983490d1a118c9bc9a5710d1d0c Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 9 Jan 2023 11:31:48 +0000 Subject: [PATCH] Improve group management --- TODO.md | 1 - generic/models.py | 6 ++ .../generic/cid_group_view_detail.html | 49 ++++++++-- generic/templates/generic/exam_cids_edit.html | 5 +- .../generic/exam_overview_headers.html | 14 ++- .../generic/user_group_view_detail.html | 43 --------- generic/views.py | 10 +- physics/templates/physics/exam_overview.html | 95 ++++++++++++------- 8 files changed, 134 insertions(+), 89 deletions(-) delete mode 100755 generic/templates/generic/user_group_view_detail.html diff --git a/TODO.md b/TODO.md index aa6eb5ec..b6e953c8 100644 --- a/TODO.md +++ b/TODO.md @@ -8,7 +8,6 @@ - Test coverage - Privacy policy - Cookie policy -- Cloning exams should include authors # Future diff --git a/generic/models.py b/generic/models.py index 154d00e9..31ed447e 100644 --- a/generic/models.py +++ b/generic/models.py @@ -178,6 +178,12 @@ class ExamBase(models.Model): def get_absolute_url(self): return reverse("{}:exam_overview".format(self.app_name), kwargs={"pk": self.pk}) + def get_cid_edit_url(self): + return reverse("{}:exam_cids_edit".format(self.app_name), kwargs={"exam_id": self.pk}) + + def get_user_edit_url(self): + return reverse("{}:exam_users_edit".format(self.app_name), kwargs={"exam_id": self.pk}) + def get_take_url(self): return f"{settings.REMOTE_URL}/rts" diff --git a/generic/templates/generic/cid_group_view_detail.html b/generic/templates/generic/cid_group_view_detail.html index 31595e32..dce2aadb 100755 --- a/generic/templates/generic/cid_group_view_detail.html +++ b/generic/templates/generic/cid_group_view_detail.html @@ -3,20 +3,40 @@ {% block content %}

Group: {{group.name}}

+
+ Help +

This page shows an overview of the candidates and exams that are associated with the group.

+ +

Once a candidate has been added to a group and the group has been added to an exam individual candidates can be allocated to the exam. Please note: simply adding the group to the exam will not automatically give the group candidates access to that exam, they will have to be added individually/as a group.

+
+

Users

-

Count: {{users|length}}

+

Count: {{users|length}}

{% if users %} - + + {% if group_type == "cid" %} + + {% else %} + + {% endif %} {% for user in users %} - + {% if group_type == "cid" %} + + {% else %} + + {% endif %} {% endfor %}
EmailCIDPasscode
EmailCIDPasscode
User
{{user.email}}{{user.cid}}{{user.passcode}}
{{user.email}}{{user.cid}}{{user.passcode}}
{{user.username}}
{% else %} - This group has no users. They can be created (or added) here + This group has no users. + + {% if group_type == "cid" %} + They can be created (or added) here + {% endif %} {% endif %}

Exams

The group is currently associated with the following exams @@ -27,17 +47,34 @@ {% for exam in value %}
  • {{exam}} + {% if group_type == "cid" %} + Edit candidates + {% else %} + Edit candidates + {% endif %} + + {% if group_type == "cid" %} + (Cid candidate count: {{exam.valid_cid_users.count}}) + {% else %} + (User candidate count: {{exam.valid_user_users.count}}) + {% endif %} +
  • {% endfor %} {% endfor %} {% endwith %} - {% endblock %} {% block js %} - {% endblock %} \ No newline at end of file diff --git a/generic/templates/generic/exam_cids_edit.html b/generic/templates/generic/exam_cids_edit.html index b08e45df..d2ad6de4 100644 --- a/generic/templates/generic/exam_cids_edit.html +++ b/generic/templates/generic/exam_cids_edit.html @@ -23,7 +23,10 @@ {% endfor %} -

    + {% comment %} Hide the toggle button if there are no users (to add or remove) {% endcomment %} + {% if current_cid_users or available_cid_users %} +

    + {% endif %}